Commit graph

18310 commits

Author SHA1 Message Date
Tomasz Bursztyka 236c5fa48d drivers/ethernet: Removing unused variables in stellaris driver
In was generating these warnings:
eth_stellaris.c:66:8: warning: unused variable ‘eth_hdr’
eth_stellaris.c:65:8: warning: unused variable ‘head_len_left’

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-21 09:34:30 -05:00
Tomasz Bursztyka 12b1381fa1 drivers/ethernet: Switch stellaris driver to new net_pkt API
Allocating all the necessary buffer at once.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-21 09:34:30 -05:00
Tomasz Bursztyka 6fabbb7d14 drivers/wifi: Switch eswifi driver to new net_pkt API
Brings tiny simplifications.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-21 09:30:57 -05:00
Tomasz Bursztyka 854045c14d drivers/modem: Switch wncm14a2a driver to new net_pkt API
It is a bit awkward that ip/proto headers have to be rebuilt (with fake
data in it though). Let's see in future if that's really needed,
offload device handles already ip/proto headers by themselves so we
should not care.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-21 09:30:57 -05:00
Tomasz Bursztyka e8b0e1f35b drivers/wifi: Switch winc1500 driver to new net_pkt API
Use tx and rx pools relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-21 09:30:57 -05:00
Tomasz Gorochowik f0db8772f5 eth: eth_mcux: wait in send for the packet to be sent [REVERT ME]
Wait in the send callback for the packet to be actually sent.
After this change, only one TX packet will be handled at once.
This is needed because of the way the TX packets are currently handled
in L2 after this PR: #12563

This is similar to what #13167 did for the SAM GMAC on SAM E-70.

Without this, packet time-stamping does not work with the current stack.

This commit is minimalistic on purpose to make it easily revertible when
the network stack is able to properly handle DMA drivers for TX packets
again.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2019-02-21 09:27:47 -05:00
Michael Scott aa226eb528 drivers: modem: wncm14a2a: stop reading when bytes read is 0
Let's also check for bytes_read == 0 after calling mdm_receiver_recv()
and if so, break the loop so we don't endlessly loop.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-02-20 10:46:54 -06:00
Sathish Kuttan 3061fb7db2 Kconfig: intel_s1000: Remove DCACHE_WRITEBACK
Remove DCACHE_WRITEBACK Kconfig variable definition in Intel S1000
DMA driver. Remove the variable from default configuration as well.

Cache configuration is fixed and the cache operation routines
internally take appropriate action based on the cache configuration.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-20 07:33:11 -05:00
Sathish Kuttan 3aa58c9b28 drivers: intel_dmic: replace cache operation macros
Replace local macros for cache invalidation and flush operations
macros from soc.h

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-20 07:33:11 -05:00
Sathish Kuttan 2f92baabe7 drivers: intel_gna: replace cache operation macros
Replace local macros for cache invalidation and flush operations
macros from soc.h

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-20 07:33:11 -05:00
Sathish Kuttan d143982129 drivers: i2s_cavs: replace cache operation macros
Replace local macros for cache invalidation and flush operations
with macros from soc.h

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-20 07:33:11 -05:00
Krzysztof Chruscinski 3605e48c44 shell: Modify subcommands to use SHELL_STATIC_SUBCMD_SET_CREATE
It is planned to deprecate SHELL_CREATE_STATIC_SUBCMD_SET macro
which is replaced by SHELL_STATIC_SUBCMD_SET_CREATE.

Additionally, removed irrelevant comments about alphabetical
ordering which is no longer needed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-20 07:31:35 -05:00
Armando Visconti 2602a18490 drivers/audio: mpxxdtyy: Align log defines to audio dmic case
Use CONFIG_AUDIO_DMIC_LOG_LEVEL macro to define mpxxdtyy driver
log levels.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-19 12:29:09 -06:00
Tomasz Bursztyka 5dc84fa6ed drivers/console: Switch telnet console driver to new net_pkt API
This simplifies a bit the driver itself as it does not need to create
the net_pkt it wants to send anymore.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-19 11:29:07 -05:00
Erwan Gouriou c55c188e68 drivers/sensor/vl53l0x: Remove unnecessary lib include check
vl53l0x driver is using an external library to build, located under:
ext/hal/st/lib/sensor/vl53l0x.
This library is expecting stdint.h lib to be available and to
secure this for driver library inclusion work, a stdint.h file
header check was done. This check was based on assumptions on possible
header names for stdint.h.
Due to recent renaming of the zephyr header files, this check was
returning a false positive, generating warning at compilation.

Rather than updated with new header names, remove this check, since
driver porting is completed and stdint.h inclusion is actually
done.

Fixes #10134

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-19 07:48:10 -06:00
Erwan Gouriou 9a07a2850b drivers/flash: Rework CMakeLists.txt for stm32 drivers
Optimize CMake rules for STM23 series driver build.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-19 07:45:50 -06:00
Erwan Gouriou 82403f68e2 drivers/flash: Move STM32F3 to generic STM32 series driver
A common driver is shared between stm32 chips, which was not the case
for stm32f3 series. As a consequence stm32f3 was not maintained
equally and was missing features such as flash layout or dts based
configuration.
Besides, drivers had some flows such as wrong bus clock and
missing HSI clock activation which lead to issues on boards not
using HSI as main clock.
As a consequence this commit moves stm32f3 series flash driver to
common stm32 flash drivers.

Fixes #4197

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-19 07:45:50 -06:00
Sebastian Bøe 1312ca7cc2 kconfig: flash: Move nrf code into it's own file
Cleanup the Kconfig code for the flash driver. Platform-specific
options should be in their own Kconfig files to be consistent and to
not pollute the common configuration.

To this end we move the nrf options into it's own file.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-15 14:12:48 -05:00
Sebastian Bøe 1f27a456cd kconfig: flash: Move mcux code into it's own file
Cleanup the Kconfig code for the flash driver. Platform-specific
options should be in their own Kconfig files to be consistent and to
not pollute the common configuration.

To this end we move the mcux options into it's own file.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-15 14:12:48 -05:00
Sebastian Bøe ae846dce75 kconfig: flash: Move nios code into it's own file
Cleanup the Kconfig code for the flash driver. Platform-specific
options should be in their own Kconfig files to be consistent and to
not pollute the common configuration.

To this end we move the nios2 options into it's own file.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-15 14:12:48 -05:00
Rajavardhan Gundi 95e8a582b4 drivers: flash: spi_nor.c: Correct the calculation of SECTORS_COUNT
The patch 44758977f8 made a change where
SECTORS_COUNT was not calculated properly. This patch corrects it.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-02-14 22:18:25 -05:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Aurelien Jarno 413ede4b89 driver: eth: gmac: remove ring_buf usage in the RX path
The ring_buf implementation is basically used as an array of net_buf
pointers in the RX path. The tail and head indexes are taken from the
RX descriptors and not from the ring_buf. That's why for example the
fact that head is never initialized doesn't cause problem. Only len is
used in free_rx_bufs(), but anyway this function is plainly broken as
it always free the first net_buf and doesn't set it back to NULL.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-14 22:15:29 -05:00
Aurelien Jarno cc1d1478ac driver: eth: gmac: wait until the packet is sent before returning
Scale down the TX path of the GMAC driver by waiting for a packet to be
fully sent before returning from the send function. This has a small
performance impact, but has a few advantages:
- It allows the Ethernet code to modify the packet afterward, fixing PTP
  support on this board (see PR #12563).
- It returns an error to the IP stack in case of a transmit failure.
- It doesn't require net_buf to be thread safe.

This change can be reverted by changing GMAC_MULTIPLE_TX_PACKETS from 0
to 1.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-14 22:15:29 -05:00
Johann Fischer 70776028f5 drivers: apds9960: fix ALS in non-trigger mode
Generate interrupt on every ALS cycle in non-trigger mode
and enable ALS saturation interrupt.

resolves: #11989

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-02-13 22:10:21 -06:00
Kumar Gala 02670ed2d7 spi: spi_mcux_lpspi: Convert to use DT_ prefixed defines
The spi mcux_lpspi driver has been using non DT_ prefixed defines for
DT generated defines.  Switch to use DT_ prefixed ones as we want to
deprecated the non DT_ prefixed defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-13 16:59:02 -05:00
Andy Gross 89fb37b76a uart: pl011: Use correct masking for ICR
This patch changes the ICR masking to use a fixed mask instead of
a buggy read/write of the current ICR to itself.  The ICR is write
only and reading this for information is unpredictable and should
be avoided.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2019-02-13 11:08:22 -06:00
Vincent Wan 581cfdb754 drivers: wifi: simplelink: Translate socket family/type/protocol values
In the SimpleLink wifi driver, the socket family value needs to be
converted to the SL_* equivalent to be understood by the SimpleLink
API, instead of being passed straight in.

While not strictly necessary, we are doing the same for socket type
and protocol values to future-proof ourselves in case similar changes
happen to the values defined for these in Zephyr header files.

Fixes #13203

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-02-13 06:48:40 -06:00
Song Qiang 5bd4f78025 driver: pinmux: stm32f4: Remove duplicated defination
There are two identical PC4-ETH pinmux defination, so
remove one.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
2019-02-13 06:46:41 -06:00
Tomasz Bursztyka ebd2edbaaf drivers/ethernet: Switch SMSC911x to new net_pkt API
It was still using old allocator and net_pkt function to read/write the
data.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Aurelien Jarno 9072d34f30 drivers: eth: gmac: drop compile-time check about number of TX packets
The GMAC driver tries to ensure that it can always send a complete
Ethernet frame. However in the TX path this is the problem of the IP
stack: if the buffers can't be allocated, they won't be sent. Therefore
just drop the check.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-12 15:38:06 -05:00
Aurelien Jarno 9e0748311f drivers: eth: gmac: reduce ETH_SAM_GMAC_BUF_RX_COUNT
Now that the RX packets are limited to the RX workqueue only, we can
reduce ETH_SAM_GMAC_BUF_RX_COUNT to 12 and still be able to receive a
full Ethernet frame. This reduces the minimum NET_BUF_RX_COUNT required
by this driver to 24.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-12 15:38:06 -05:00
Aurelien Jarno 96a6e40bee Revert "drivers: eth: gmac: conservatively compute the number of descriptors"
This reverts commit afbee4c96a. The IP
stack has been fixed and does not use the RX packets or buffers to
transmit data.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-12 15:38:06 -05:00
Erwan Gouriou 5622efad98 drivers/gpio: stm32: Return errors on not supported config
Following configuration options are not supported by STM32
gpio driver:
-GPIO_INT_LEVEL
-GPIO_POL_INV
Return an error when one of these is requested.

Fixes #12766

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-12 09:44:02 -05:00
Alexander Wachter 8757e780fc drivers: can: Update userspace handlers
This commit updates the userspace handlers to thle latest version.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-12 09:39:30 -05:00
Alexander Wachter 873875411e drivers: can: stm32_can rework
This commit makes the stm32 CAN driver more readable and fix
a bug where the usage and rx_response array are not shifted correctly.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-12 09:39:30 -05:00
Kumar Gala 6e5572ab8c pwm: pwm_sifive: Fix LOG Kconfig typo
LOG_LEVEL should be set to CONFIG_PWM_LOG_LEVEL not
CONFIG_LOG_PWM_LEVEL. In cleaning this up use
LOG_MODULE_REGISTER(x,y) form to reduce 2 lines to 1.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-12 07:50:06 -05:00
Kumar Gala b0e7d312db modem: Fix LOG Kconfig typo
LOG_LEVEL should be set to CONFIG_MODEM_LOG_LEVEL not
CONFIG_LOG_MODEM_LEVEL.  In cleaning this up use
LOG_MODULE_REGISTER(x,y) form to reduce 3 lines to 1.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-12 07:50:06 -05:00
Kumar Gala 9aa027b402 drivers: i2c: i2c_esp32: Fix Kconfig typo mismatch
The Kconfig symbols for RX/TX LSB first didn't match between the driver
and the Kconfig file.  Change driver to match Kconfig symbol names

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-11 22:29:58 -05:00
Kumar Gala d6a19afb29 drivers: counter: mcux: Fix sanitycheck test build issue
The generated defines RTC_0_CLOCK_FREQUENCY and RTC_0_PRESCALER are
maked as deprecated by dts generation.  This causes a build warning and
an error during sanitycheck runs.  Replace with the DT_ prefixed
versions that are not deprecated.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-11 09:40:27 -06:00
Tomasz Gorochowik 436f1123c8 eth: eth_mcux: Fix the DT_ prefixed defines
Commit 040d6b6e99 (eth: eth_mcux: Convert to use DT_ prefixed defines)
changed all the defines, but to incorrect ones.

This commit changes them to what actually gets generated.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2019-02-11 09:39:28 -06:00
Aurelien Jarno 2682170502 drivers: hwinfo: fix shell dependency
The hwinfo shell uses shell functions and thus doesn't build when
CONFIG_SHELL=n. Fix that by adding a dependency on SHELL.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-10 12:24:04 -05:00
Yannis Damigos 6a676caab6 usb_dc_stm32: Fix check endpoint capabilities
DT_USB_NUM_BIDIR_ENDPOINTS includes EP0, which we should not
take it into account when we check endpoint capabilities

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2019-02-09 16:58:22 -06:00
Uri Shaked 2e68bc02b9 drivers: ssd1673: fix typo in string
then -> than

Signed-off-by: Uri Shaked <uri@urishaked.com>
2019-02-09 07:45:57 -05:00
Kumar Gala 7b4ee6bd45 flash: spi_nor: Convert FLASH_{WRITE,ERASE}_BLOCK_SIZE to DT_
Convert generic FLASH_{WRITE,ERASE}_BLOCK_SIZE to driver specific
generated define DT_JEDEC_SPI_NOR_0_{WRITE,ERASE}_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala b0308f7fcd flash: flash_gecko: Convert FLASH_WRITE_BLOCK_SIZE to DT_
Convert generic FLASH_WRITE_BLOCK_SIZE to driver specific generated
define DT_SOC_NV_FLASH_0_WRITE_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala 73f2466f00 flash: flash_sam: Convert FLASH_{WRITE,ERASE}_BLOCK_SIZE to DT_
Convert generic FLASH_{WRITE,ERASE}_BLOCK_SIZE to driver specific
generated define DT_SOC_NV_FLASH_0_{WRITE,ERASE}_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala 590b5a08a2 flash: soc_flash_mcux: Convert FLASH_ERASE_BLOCK_SIZE to DT_
Convert generic FLASH_ERASE_BLOCK_SIZE to driver specific generated
define DT_SOC_NV_FLASH_0_ERASE_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala f6c7e9a997 flash: flash_stm32: Convert FLASH_WRITE_BLOCK_SIZE to DT_
Convert generic FLASH_WRITE_BLOCK_SIZE to driver specific generated
define DT_SOC_NV_FLASH_0_WRITE_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala 4c51684918 drivers: i2c: dw: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert designware i2c driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:50:07 -05:00
Francisco Munoz 2ab60eb0ab serial/uart_ns16550: make UART_REG_ADDR_INTERVAL
On behalf of : Timo Teräs <timo.teras@iki.fi>

UART_REG_ADDR_INTERVAL is SOC / chip implementation specific feature,
and its width does not always correspond to current settings for
IOPORT/non IOPORT access method.

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
2019-02-08 21:38:54 -05:00
Kumar Gala 040d6b6e99 eth: eth_mcux: Convert to use DT_ prefixed defines
The eth mcux driver has been using non DT_ prefixed defines for DT
generated defines.  Switch to use DT_ prefixed ones as we want to
deprecated the non DT_ prefixed defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 16:03:17 -06:00
Kumar Gala 36bd564acc i2c: i2c_imx: Convert to use DT_ prefixed defines
The i2c_imx driver has been using non DT_ prefixed defines for DT
generated defines.  Switch to use DT_ prefixed ones as we want to
deprecated the non DT_ prefixed defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 16:03:17 -06:00
Kumar Gala 93a9e0b3fe gpio: mcux: Convert to use DT_ prefixed defines
The gpio mcux driver has been using non DT_ prefixed defines for DT
generated defines.  Switch to use DT_ prefixed ones as we want to
deprecated the non DT_ prefixed defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 16:03:17 -06:00
Armando Visconti 208f565bce driver/sensor: add LIS2DW12 sensor support
Add support to STM LIS2DW12 3-axis accelerometer driver.
The driver support I2C and SPI bus communication and both
polling and drdy trigger mode.

Co-authored-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-08 15:22:42 -06:00
Aurelien Jarno 589075a354 drivers: ssd1673: add support for HINK E0154A05
Add support for HINK E0154A05 display, used notably in the Waveshare
1.54inch e-Paper Module.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-08 14:57:36 -05:00
Johann Fischer 7402e3db46 drivers: ssd1673: add support for SSD1608 and GDE029A1
Add support for SSD1608 controller and GDE029A1 display.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-02-08 14:57:36 -05:00
Johann Fischer c2fe802479 drivers: ssd1673: use compatible property to identify display
Use compatible property to identify display and select
proper LUT for display controller.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-02-08 14:57:36 -05:00
Johann Fischer f7495ef8eb drivers: ssd1673: add DT properties for configuration registers
The values for the registers like GDV, SDV and Boarder Waveform
depend on the panel and display controller. Add DT properties
and obtain such values from DT.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-02-08 14:57:36 -05:00
Johann Fischer fbd527d562 drivers: ssd1673: remove unnecessary defines
Remove unnecessary defines.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-02-08 14:57:36 -05:00
Kumar Gala ff70b3444f dts: Convert CONFIG_ to DT_ symbols for chosen props
Replace generating CONFIG_ symbols with DT_ symbols for chosen
properties like 'zephyr,console' or 'zephyr,bt-mon-uart'.  We now use a
kconfigfunctions (dt_str_val) to extract the info from dts into Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 11:41:26 -06:00
Jukka Rissanen fc9e414ebf drivers: can: stm32: Add socket CAN support
Add support for socket CAN functionality. This means that user
is able to use BSD socket interface to send and receive CAN
packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-08 12:03:34 -05:00
Kumar Gala 2b23e04514 spi: spi_dw: Cleanup stale Kconfig symbols that should be DT
Instance 2 & 3 for some reason never transitioned CONFIG_SPI_*_IRQ_* to
DT prefix.  Fix that since those Kconfig symbols will never exist.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 09:34:37 -06:00
Nathaniel Graff 1dc3cc7fc6 drivers/pwm: Driver for SiFive PWM peripheral
The PWM driver can only control channels 1-3 of the PWM peripheral, not
channel 0. This is an artifact of the peripheral's design.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2019-02-08 09:09:35 -06:00
Anas Nashif 8e5ac20665 counter: qmsi: use correct function prototype
rtc_qmsi_cancel_alarm requires channel id argument.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-08 08:56:45 -05:00
Savinay Dharmappa 60348e8081 drivers: counter: incorporate changes of api name and signature.
patch incorporates new api name and signature changes.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-02-08 08:56:45 -05:00
Andrei Emeltchenko bd7d48a61f usb: native_posix: Fix ep_configure() and ep_mps()
Fix issues found in unit tests.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-08 07:56:24 -05:00
Aurelien Jarno 2168d80987 drivers: add Atmel SAM PWM driver
This patch adds basic support for the PWM devices available on the Atmel
SAM family. Beside enabling the driver, everything is selected through
the device tree, including enabling the PWM0 and PWM1 devices. Thus
CONFIG_PWM_0 and CONFIG_PWM_1 are ignored.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-08 06:55:14 -06:00
Andrei Gansari 1d50a09575 drivers: eth_dw: changed stranded error message
Replaced CONFIG_NET_DEBUG_L2_ETHERNET with
CONFIG_ETHERNET_LOG_LEVEL >= LOG_LEVEL_DBG

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-02-08 13:57:55 +02:00
Aurelien Jarno fa91da4992 drivers: eth: gmac: only keep a reference to the packet when PTP is used
The SAM GMAC Ethernet driver currently keeps a reference to the packet
being sent in addition than keeping of references of the fragments. In
practice this is only needed when PTP is enabled, otherwise the driver
only need to prevent the fragment (or even their content) to be changed.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-08 12:41:11 +02:00
Aurelien Jarno 757d86b241 drivers: eth: gmac: keep a reference to the packet fragments
The SAM GMAC Ethernet driver uses scatter gather DMA to transmit data.
Each fragment of a network packet is mapped from a set of descriptors
that is used by the controller to do the DMA transfer. This means that
the packet is not necessary sent when the send() function returns. For
that reason the driver calls net_pkt_ref() on the packet to prevent it
from being freed. It is then unreferenced with net_pkt_unref() in the
TX ISR when the packet has effectively been sent.

However this doesn't work if the packet is modified in the meantime,
like it will be done in PR #12563 to remove the Ethernet header
contained in the first fragment. To avoid that, call net_pkt_frag_ref()
on each fragment of the packet, and unreferenced them with
net_pkt_frag_unref() in the TX ISR when the packet has effectively been
sent.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-08 12:41:11 +02:00
Piotr Mienkowski 8a86b5aaac api: counter: rename counter_disable_channel_alarm()
The function to set channel alarm is called counter_set_channel_alarm.
To match the name of the function performing the reverse operation this
commit renames counter_disable_channel_alarm() function to
counter_cancel_channel_alarm().

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-08 10:47:40 +01:00
Daniel Leung d9da0b07cd gpio: gpio_sch: fix check for interrupt trigger
The controller does not support trigger. However, the check for
this condition was incorrectly (as GPIO_INT_LEVEL is 0). So fix
it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-07 22:47:11 -06:00
Peter A. Bigot 0a0e3cdea6 drivers: gpio: esp32: correct constant test for interrupt trigger
Interrupts default to trigger on level for historical reasons, so use of
GPIO_INT_LEVEL` as a mask results in a zero value.  Use a mask macro to
isolate the trigger configuration.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:46:37 -06:00
Peter A. Bigot aa684363f0 drivers: sht3xd: update to new I2C API
Use the new i2c_write_read() wrapper to simplify the code.

Also add several overlays used to test the sensor on a variety of
boards, and conf file support for trigger testing.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:04:28 -05:00
Peter A. Bigot 4d7c06702c drivers: eth_sam_gmac: replace deprecated API
Replace the sole use of i2c_burst_read_addr with a more generic API
function to allow the former to be deprecated along with its unreliable
sibling write and update functions.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:04:28 -05:00
Erwan Gouriou d2e305491f soc: stm32: Convert CONFIG_RTC leftover to DT_
Convert CONFIG_RTC_0_IRQ_PRI to DT_ namespace.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-07 16:14:00 -05:00
Erwan Gouriou 3074e393db drivers/counter: stm32 rtc: Use dts to get RTC clock information
RTC clock information should be provided by dts files

Fixes #10451

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-07 16:14:00 -05:00
Erwan Gouriou 458226e1f7 drivers/counter: stm32: Provide STM32 RTC driver using counter API
Provides a STM32 RTC driver using new counter API.
Driver does not support wrap related functions (set, get, ..)

Fixes #11373

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-07 16:14:00 -05:00
Kumar Gala 7809970c8a drivers: counter: cmsdk: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert cmsdk driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 16:14:00 -05:00
Kumar Gala 36427f8bbb drivers: timer: Move Dual Timer API to unified interface
The CMSDK Dual Timer can be used as a timer or as a counter.
The unified interface proposed in #8340 unifies counter.h and rtc.h to
provide a common interface.

This patch modifies the timer implementation of the dual timer to
make it compliant with the new proposed interface.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 16:14:00 -05:00
Kumar Gala 6fca18de60 drivers: timer: Move Timer API to unified interface
The CMSDK Timer can be used as a timer or as a counter.
The unified interface proposed in #8340 unifies counter.h and rtc.h to
provide a common interface.

This patch modifies the timer implementation of the single timer to
make it compliant with the new proposed interface.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-07 16:14:00 -05:00
Maureen Helm 210a71f108 tests: counter: Enable debug logging
Enables debug logging in the counter_basic_api test. Fixes a build error
in the nrf counter drivers when logging is enabled.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-02-07 16:14:00 -05:00
Maureen Helm eb338915bb drivers: counter: Introduce mcux rtc shim
Adds a shim layer around the mcux rtc driver to adapt it to the zephyr
counter interface. Portions of this driver are reused from the existing
rtc driver in drivers/rtc/rtc_mcux.c.

The hardware supports a single alarm only and a fixed wrap value.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski 7de898d337 drivers: counter: Fix default top value callback in counter_nrfx_rtc.c
In case of default top value, driver was calling top value
callback only on the first period. This was not expected behavior.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Stanislav Poboril f51ef0551c imx: Add IMX EPIT driver for i.MX socs
Add shim driver for i.MX EPIT (Enhanced Periodic Interrupt Timer)
peripheral which can be used for i.MX6SoloX, i.MX7D and other i.MX socs.

Origin: Original

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski 708f08a4be drivers: counter: Rename wrap to top_value
Renamed:
- counter_set_wrap to counter_set_top_value
- counter_get_wrap to counter_get_top_value
- counter_get_max_wrap to counter_get_max_top_value

Updated nRF implementations and counter test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski b745355315 drivers: counter: Add user_data to alarm callback
Modify alarm callback to return user_data and channel_id.
Set_alarm and disable_alarm updated accordingly. Renamed
counter_*_ch_alarm to counter_*_channel_alarm. Updated test
and nrf implementations.

Updated doxygen comments.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski 5bfe8612a2 drivers: timer: Fix broken dependency for nrf_rtc_timer
nrf_rtc_timer was selecting counter RTC1 instance even though it
is not using counter API at all.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski 5d0d5c0a7a drivers: counter: Counter API implementation for nRF Series (RTC).
Shim for counter API using nrfx_rtc driver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Peter A. Bigot 49c8325339 drivers: counter: nrfx: update to newer HAL API
Upstream trunk moved to a newer Nordic HAL that changed file and
constant names.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-07 16:14:00 -05:00
Peter A. Bigot e03c3d8f79 drivers: timer: conflict RTC timer with RTC1 counter
The system timer uses RTC1, but does not implement the counter API with
it.  Instead of auto-enabling the counter API on the system timer make
the two conflict until/unless both APIs are supported by the peripheral.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 16:14:00 -05:00
Peter A. Bigot 889a55c86a drivers: counter: nrf: make name configuration consistent
Using `COUNTER_2_NAME` when all other properties are
`COUNTER_TIMER2_foo` is confusing.  Make the names consistent.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 16:14:00 -05:00
Savinay Dharmappa 0f492149ad rtc: rename CONFIG_RTC_0_NAME to DT_RTC_0_NAME.
patch renames CONFIG_RTC_0_NAME to DT_RTC_0_NAME.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-02-07 16:14:00 -05:00
Savinay Dharmappa aa15f3973a drivers: rtc_qmsi: Move rtc driver apis to unified interface
patch modifies rtc apis to unified interface.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-02-07 16:14:00 -05:00
Savinay Dharmappa 9cd7803579 drivers: counter: Move AON and AONPT driver api to unified interface
patch modifies AON and AONPT driver api to unified interface

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-02-07 16:14:00 -05:00
Krzysztof Chruscinski da0d9bab2d drivers: counter: Counter API implementation for nRF Series (RTC).
Shim for counter API using nrfx_rtc driver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Krzysztof Chruściński 6b4ff1252a drivers: counter: Counter API implementation for nRF Series (TIMER).
Shim for counter API using nrfx_timer driver.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2019-02-07 16:14:00 -05:00
Alexander Wachter ad92d5bfe9 drivers: hwinfo: add driver support for NXP i.mx RT device ID
Add driver support for NXP i.mx RT ID device.
This device has an ID of 8 bytes.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-07 15:08:18 -06:00
Alexander Wachter 50156e0ea9 drivers: hwinfo: add driver support for kinetis device ID
Add driver support for kinetis ID device.
The length depends on the SoC.
`SIM_GetUniqueId` was not used because the struct would reorder
the ID and makes the driver more complicated because the length
of the struct depends on the SoC.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-07 15:08:18 -06:00
Maureen Helm ab84cbfc40 drivers: display: Introduce mcux elcdif shim driver
Adds a shim layer around the mcux elcdif driver to adapt it to the
zephyr display interface. Although the hardware and underlying mcux sdk
driver can support additional configurations, some shortcuts are
currently made in the shim that force a given pixel format, lcd data
bus width, and signal polarity. This works with the rocktech lcd module
used on imx rt boards, but will need to be updated for other display
panels.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-02-07 14:28:55 -06:00
Daniel Leung 69d4d32acf gpio: gpio_sch: error when configure for level triggers
The GPIO controller only supports edge triggering according to
the descriptions of the associated registers. So errors out
when level trigger is requested. Also adds the option to do
double edges triggering as the controller supports this.

Fixes #12763

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-07 11:18:23 -06:00
Nathaniel Graff b0844959f6 drivers/i2c: I2C driver for SiFive Freedom
Driver for the I2C peripheral in the SiFive Blocks RTL
Repository (https://github.com/sifive/sifive-blocks).

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2019-02-07 10:47:48 -06:00
Armando Visconti 620ff636d4 drivers/pinmux: stm32: (FIX) Force very_high speed to SPIx_SCK gpio
Fix issue #9028: last bit of SPI/I2S transaction may be corrupted.
Impacted STM32 SOC series: F0/F1/F2/F3/F4/L0.

Notes:
- F2/F4/L0: set gpio to very_high speed ('11')
- F0/F3: set gpio to high speed ('11').
- F1: set gpio to 50MHz.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-07 10:45:10 -06:00
Erwan Gouriou 3a447c8d8d driver/interrupt_controller: Clean up Kconfig symbol in stm32 driver
Cleanup unknown symbol in commentary.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-06 18:59:00 -06:00
Erwan Gouriou b0245d4240 drivers: spi: Define SPI_6 symbol
Add SPI_6 Kconfig symbol as this is the higher supported instance on
STM32.
This makes symbol CONFIG_SPI_6, used in stm32 driver a valid symbol.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-06 18:59:00 -06:00
Kumar Gala 4520237ef5 sensors: adxl372: Fixup SPI CS handling
Replace undefined Kconfig SPI CS defines with DTS based defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-06 14:01:51 -06:00
Nathaniel Graff 9e2ef8db6d drivers/spi: SPI driver for SiFive Freedom
A driver for the sifive,spi0 SPI device on SiFive Freedom platforms

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2019-02-06 09:00:00 -06:00
Takumi Ando 782a88f2c1 driver: usb: nordic: Fix compile warning with newlib
This commit fixes compile warning with CONFIG_NRFX_USB
and CONFIG_NEWLIB_LIBC.

Signed-off-by: Takumi Ando <takumi.ando@atmark-techno.com>
2019-02-06 14:25:09 +01:00
Andrzej Głąbek e2b38e02bf drivers: pwm: nrf: Use HW PWM by default when available
Enable HW PWM driver instead of the SW one on nRF SoCs where the PWM
peripheral is present.
Default PWM instances are also enabled on Nordic DK boards so that it
is possible to build the basic fade_led sample for them without extra
adjustments.

After the above changes are applied, some configuration alterations
in basic samples blink_led and fade_led become no longer needed.
These are removed. And the blink_led sample is corrected so that it
works with the nRF HW PWM driver as well.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-02-06 07:19:07 -05:00
Daniel Leung f7a42a70f8 gpio: intel_apl: rework driver for pin_mask callback
To avoid confusion, callbacks using ordinal pin numbers
is going to be reverted. So the driver has to be re-worked
to expose multiple devices so each device has 32 pins.

Also fixes #12765

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-06 07:18:15 -05:00
Daniel Leung 7695a72e3c drivers/interrupt_controller: shared_irq: configure by device tree
This allows the shared_irq driver to be configured by device tree.
With previous implementation, only the board configuration can
override the IRQ trigger, as the trigger config is a "choice" rather
than "config". With this patch, the driver can be fully configued at
the SoC level.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-06 07:18:15 -05:00
Bobby Noelte 666cf22c60 arch: allow system clock driver selection for cortex m
The selection of the Cortex M systick driver to be used
as a system clock driver is controlled by
CONFIG_CORTEX_M_SYSTICK.

To replace it by another driver CONFIG_CORTEX_M_SYSTICK
must be set to 'n'. Unfortunately this also controls
the interrupt vector for the systick interrupt. It is
now routed to __reserved. More bad the interrupt vector
can not be set by IRQ_CONNECT as it is one of the hard
coded interrupts in the interrupt table.

Route the hard coded systick interrupt to z_clock_isr
and make z_clock_isr a weak symbol that can be overwritten
by an alternative systick system clock driver.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2019-02-05 18:43:03 -06:00
Peter A. Bigot d75495709d drivers: gpio: fix mis-use of slist API in callback processing
The iterator over registered callbacks failed to account for the
possibility that the callback would remove itself from the list.  If
this occurred any remaining callbacks would no longer be reachable from
the node.  Switch to the slist iterator that is safe for self-removal.

Note that the slist API remains unsafe for removal of subsequent nodes.
Even with the corrected code removal of the next callback registration
(cached in tmp) will result in it being called anyway, with the
remaining unremoved registrations not being called.  If the next
callback were removed and re-registered on a different device, the
callbacks would be invoked for the wrong device.

Resolve this by a documentation change describing the conditions under
which a change to callback registration from within a callback are
permitted.  Add a similar note regarding the effect of adding a
callback.  The current event invocation behavior for callbacks added
within an event is explicitly left unspecified, though in the current
slist implementation newly added callbacks will not be invoked until the
next event.

Closes #10186

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-05 12:33:25 -06:00
Paweł Zadrożniak 85d75ec853 drivers: usb: nordic: Power consumption fix with cable detached
This commit fixes the issue with excess current being drawn
during sleep due to active HFCLK with external crystal.
Clock-related operations were moved to cable attachmend and
detachment handlers to ensure that HFCLK is not requested
when it's not needed.

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2019-02-04 20:48:25 -05:00
Anas Nashif 5846697591 flash: shell: fix dependency on FLASH_PAGE_LAYOUT
Fix dependency, it should depend on FLASH_PAGE_LAYOUT rather than
FLASH_HAS_PAGE_LAYOUT.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-04 17:55:40 -05:00
Anas Nashif 602b30bafe gpio_shell: use convenience macros
use shell_error and shell_print and fix return errors using errno.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-04 17:55:40 -05:00
Alexander Wachter 7b1e9e9b34 drivers: hwinfo: Add shell command for device id
This commit adds support for device id shell command.
Example:
uart:~$ hwinfo devid
Length: 12
ID: 0x1b0320d51485330313420

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-04 14:53:50 -05:00
Erwin Rol 28c01b6219 drivers: can: fix typo
Fix another typo in the stm32_can.h header file, swj -> sjw.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2019-02-04 12:59:26 -05:00
Kumar Gala 2d90772244 sensor: lis2ds12: Fixup SPI CS handling
Replace undefined Kconfig SPI CS defines with DTS based defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-04 08:17:08 -06:00
Sathish Kuttan b72f5fd033 drivers: i2s_cavs: fix for I2S start after stop
Fixed an issue I2S wouldn't resume when started after a stop
Added code to empty the TX/RX FIFOs upon stop
TX stop is achieved by letting FIFO underrun, then changing state in ISR
RX FIFO is read until empty when RX is stopped

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-04 00:52:15 -05:00
Sathish Kuttan d835714de3 drivers: i2s_cavs: macros for object instantiation
Add macros to define and instantiate driver objects
for multiple instances

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-04 00:52:15 -05:00
Sathish Kuttan 6ff32c7877 drivers: i2s_cavs: reduce buffer queue length
Reduce the length of internal buffer queue from 4 down to 2.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-04 00:52:15 -05:00
Sathish Kuttan 3ea0bf06f5 drivers: i2s_cavs: add transmit underrun status
Add the definition for transmit underrun indicator bit in
I2S status register.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-02-04 00:52:15 -05:00
Alexander Wachter 841f72f81e drivers: hwinfo: add driver support for Nordic NRF device ID
Add driver support for Nordic NRF ID device.
This device has an ID of 8 bytes.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-03 12:07:20 -05:00
Alexander Wachter 8f3e6ab5d2 drivers: hwinfo: add driver support for STM32 device ID
Add driver support for STM32 ID device.
This device has an ID of 12 bytes.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-03 12:07:20 -05:00
Alexander Wachter 5b59c10fc4 drivers: Add hwinfo API
This commit adds a new hardware info API.
With this API it is possible to read out the device ID.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-03 12:07:20 -05:00
Aurelien Jarno 0b7e790250 display: ssd1673: add support for ssd16xx monochrome controllers
From the driver point of view, monochrome controllers from the ssd16xx
family mostly differ by the amount of row and columns that are
supported. If they support more than 256 rows and/or columns the
corresponding size or position is sent using 2 bytes instead of 1 byte.

This patch therefore adds the width-bits and height-bits DT properties
to make this configurable.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-02 10:28:11 -05:00
Aurelien Jarno 9f54c06eac display: ssd1673: replace hardcoded display dimensions by DT values
Instead of hardcoding multiple times the display dimensions, use the
values from DT. This still assume 8 rows per page and 8 pixels per
bytes, but that should always be the case for this controller and a
monochrome display.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-02 10:28:11 -05:00
Aurelien Jarno 0a0c5adde5 display: ssd1673: drop unused constants
Drop constants that are unused and hardcoded to the display dimensions.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-02 10:28:11 -05:00
Erwan Gouriou 8ce7921451 drivers/watchdog: stm32: Disable IWDG_STM32_START_AT_BOOT by default
STM32 specific behavior "IWDG_STM32_START_AT_BOOT" is enabled
by default. As all vendor specific behavior, this is preferred
to be disabled by default and activated at application level,
so application can have better control of the driver.
For instance watchdog test can't run with this setting.
Disable by default.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-01 19:16:59 -05:00
Erwan Gouriou 7ae381a808 drivers/watchdog: stm32: move driver to dts based configuration
STM32 watchdog driver is now configured from device tree settings.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-01 19:16:59 -05:00
qianfan Zhao 634e482fe1 samples: watchdog: Remove stm32 iwdg sample
STM32 iwdg driver are convented to new API now, the old sample
are doesn't need again.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2019-02-01 19:16:59 -05:00
qianfan Zhao 107375da8d drivers: iwdg_stm32: Convent STM32 watchdong driver to new API
Fixes: #10917

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.com>
2019-02-01 19:16:59 -05:00
Andrzej Głąbek f6e42a3ecf dts: bindings: Add separate binding for Nordic nRF Family SPI Slave
Use separate bindings for nRF Family SPI Slaves and SPI Masters so that
the properties "csn" and "def-char" can be made required for Slaves
(for Masters such settings are not applicable), and to avoid confusion
between the properties "csn" and "cs-gpios" for Master nodes.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-02-01 19:12:57 -05:00
Andrzej Głąbek c047e8e469 drivers: bluetooth: hci_spi: Use DT instead of Kconfig to get HW params
Convert the HCI SPI driver to get the SPI and GPIO settings from Device
Tree instead of Kconfig. The "zephyr,bt-hci-spi" binding is used as
a common one for this purpose ("st,spbtle-rf" is removed), to take
advantage of the new DT_<COMPAT>_<INSTANCE> generated macros and get
rid of related fixups and aliases.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-02-01 19:12:57 -05:00
Piotr Mienkowski bca692ee8c drivers: i2c_gecko: use DT_<COMPAT>_<INSTANCE>_<PROP> defines
Use the new DT_<COMPAT>_<INSTANCE>_<PROP> defines to instantiate
devices. This commit adds also ability to define individual pin
locations on SoC series that support the feature. Definitions of GPIO
pins assigned to a given location have been moved from soc_pinmap.h file
to board DTS file.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-01 19:09:06 -05:00
Erwin Rol 47fb24fea3 drivers: can: fix typos
- swj -> sjw (Sync Jump Width)
- CAN_MAX_NUMBER_OF_FILTES -> CAN_MAX_NUMBER_OF_FILTERS

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2019-02-01 19:07:57 -05:00
Tom Burdick 08d900df4b usb: fix usb data race
Clock ISR would callback into the USB driver before it was initialized
and ready to deal with events. This caused a fault.

Statically initialize the fifo to queue events and process them when the
USB device is initialized to avoid the problem.

Signed-off-by: Tom Burdick <thomas.burdick@gmail.com>
2019-02-01 19:04:07 -05:00
Andrei Emeltchenko b6b5fdac32 usb: native_posix: Implement other then Control transfers
Add support for other transfers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-01 19:03:12 -05:00
Andrei Emeltchenko 80120871ed usb: native_posix: Move to new logging subsystem
Use new logger log method.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-01 19:03:12 -05:00
Andrei Emeltchenko 9f1443e18a usb: native_posix: Use non-blocking connection socket
Use non-blocking connfd from accept4() call for native_posix.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-01 19:03:12 -05:00
Andrei Emeltchenko 03b7d9f59d usb: native_posix: Use non-blocking socket
Use non-blocking socket for native_posix to allow other processes to
run.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-01 19:03:12 -05:00
Andrei Emeltchenko b8b86c4c75 usb: driver: Add native_posix USB driver
Add native_posix USB virtual driver connected over USBIP to the Host
Linux.

Fixes: #9846

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-01 19:03:12 -05:00
Kumar Gala 6ed355110a pwm: pwm_mcux_ftm: Fixed missed CONFIG_ -> DT_ conversion
Some defines should have been converted from CONFIG_ to DT_ prefix.  For
some reason they got missed in this driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 19:01:16 -05:00
Kumar Gala 0d7df182e1 spie: spi_sam0: Don't use CONFIG_ namespace for non Kconfig
The driver was defining a macro with a CONFIG_ prefix but this wasn't
coming from Kconfig.  Change the macro name not to conflict with the
Kconfig CONFIG_ namespace.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 19:01:16 -05:00
Kumar Gala e6e580305b serial: uart_sam0: Don't use CONFIG_ namespace for non Kconfig
The driver was defining a macro with a CONFIG_ prefix but this wasn't
coming from Kconfig.  Change the macro name not to conflict with the
Kconfig CONFIG_ namespace.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 19:01:16 -05:00
Kumar Gala b57357085d drivers: serial: uart_miv: Fix trivial comment mismatch
comment on #endif didn't match #ifdef

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 19:01:16 -05:00
Kumar Gala 03bfb18c61 drivers: watchdog: remove deprecated apis
Its been at least 2 releases since we marked a number of watchdog APIs
as deprecated.  Lets remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 10:37:49 -06:00
Piotr Mienkowski dc6066946e drivers: mb_display: remove usage of gpio_port_ functions.
gpio_port_ functions are being deprecated. This commit removes their
usage.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-01 08:57:58 -05:00
Tomasz Bursztyka 4b78a251d7 net/context: Make recv_cb providing the ip and protocol headers
If status is 0, both ip_hdr and proto_hdr will own a pointer to the
relevant IP and Protocol headers. In order to know which of ipv4/ipv6
and udp/tcp one will need to use respectively net_pkt_family(pkt) and
net_context_get_ip_proto(context).

Having access to those headers directly, many callbacks will not need
to parse the packet again no get the src/dst addresses or the src/dst
ports. This will be change after this commit.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Tomasz Bursztyka c14a5c896f drivers/ethernet: Use new net_pkt API for sending and receiving
Use the new API where relevant. Only sam_gmac is left aside for now.

This simplifies a lot the code as the caller should only care about
allocating net_pkt and its buffer once, and thus will not need to mess
with "frags" etc...

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Peter A. Bigot e7303cb09a boards: nrf52840_pca10056: add bindings for on-board serial flash
This board has an on-board 64 Mibit serial flash from Macronix.  Add
bindings to access it.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-01 04:21:40 -06:00
Peter A. Bigot 44758977f8 drivers: flash: spi-nor: update towards device-tree support
Use the jedec,spi-nor bindings to configure as much of the device as can
be expressed by device tree.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-01 04:21:40 -06:00
Armando Visconti 37e77f942a driver/sensor: lps25hb: align driver to auto-generated dts macros
Use auto-generated device tree macros in LPS25HB driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-01 04:19:42 -06:00
Armando Visconti 396ffbd86d driver/sensor: lsm6ds0: align driver to auto-generated dts macros
Use auto-generated device tree macros in LSM6DS0 driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-01 04:19:42 -06:00
Piotr Mienkowski 91786e96aa drivers: leuart_gecko: use DT_<COMPAT>_<INSTANCE>_<PROP> defines
Use the new DT_<COMPAT>_<INSTANCE>_<PROP> defines to instantiate
devices. This commit adds also ability to define individual pin
locations on SoC series that support the feature. Definitions of GPIO
pins assigned to a given location have been moved from soc_pinmap.h file
to board DTS file.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-01 04:18:50 -06:00
Kumar Gala 9e4016d8dc usb: usb_dc_stm32: Convert to DT instance defines to remove dts_fixup.h
Convert usb_dc_stm32 driver GPIO disconnect to use new defines so we
can remove the dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 04:12:15 -06:00
Kumar Gala e0349fb421 sensor: lsm6dsl: Fixup SPI CS handling
Replace undefined Kconfig SPI CS defines with DTS based defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 04:11:23 -06:00
Kumar Gala 935d6855d9 display: ili9340: Fixup SPI CS handling
Replace undefined Kconfig SPI CS defines with DTS based defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 04:11:01 -06:00
Kumar Gala b5a86baa57 ieee802154: mcr20a: Fixup SPI CS handling
Replace undefined Kconfig SPI CS defines with DTS based defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 04:10:09 -06:00
Kumar Gala de20c10691 ieee802154: mcr20a: Remove dead Kconfig symbols
We have moved GPIO info to DT so the Kconfig symbols for GPIO lines
aren't used anymore.  We can just remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 04:10:09 -06:00
Kumar Gala 0370dbee4a usb: usb_dc: Replace CONFIG_ symbols that should be DT_
1. Fix trailing comment for DT_USBHS_MAXIMUM_SPEED
2. Fix missed CONFIG_USB_HS_BASE_ADDRES that should be
   DT_USB_HS_BASE_ADDRESS

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 04:08:26 -06:00
Anas Nashif a93651085e boards: remove pulpino board
This board is unmaintained and unsupported. It is not known to work and
has lots of conditional code across the tree that makes code
unmaintainable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-31 22:47:18 -05:00
Andrei Gansari addafb8222 mimxrt1050_evk: eth_mcux: prevent PHY NANDTree
Force Operation Mode Strap Override register to disable NANDTree. This
is due to some users reporting PHY entering NANDTree.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-01-31 13:22:58 -06:00
Andrei Gansari 0787936d15 mimxrt1050_evk: eth_mcux: driver fixup
Boot PHY initialization timeout, caching mechanism fixes and networking
buffer descriptors moved to no cache section. Enabled cache management
in networking driver and manual barriers.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-01-31 13:22:58 -06:00
Andrei Gansari 6d36f2e2f4 mimxrt1050_evk: cache enable
Cacheing mechanisms enabled and non-cache area added.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-01-31 13:22:58 -06:00
Kumar Gala 82f5c5e565 uart: sifive: Fix trivial CONFIG -> DT missed conversion
CONFIG_SIFIVE_UART_1_LABEL should have been DT_SIFIVE_UART_1_LABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-31 11:38:40 -05:00
Kumar Gala 13fd996178 sensor: lsm9ds0: Remove unused define/Kconfig symbol
We use DT to get the I2C address, so the define that got it from a
Kconfig sybmol isn't used and the Kconfig symbol isnt defined.  Remove
this dead code.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-31 09:10:29 -06:00
Kumar Gala 75d84ffd7a led: lp3943: Remove dts_fixup.h
Since the lp3943 led driver still supports both DTS and non-DTS
configuration, we update the code to use DT_<COMPAT>_<INSTANCE>
defines for the CONFIG_HAS_DTS_I2C case.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-31 09:09:36 -06:00
Kumar Gala 489cecd505 led: pca9633: Remove dts_fixup.h
Since the pca9633 led driver still supports both DTS and non-DTS
configuration, we update the code to use DT_<COMPAT>_<INSTANCE>
defines for the CONFIG_HAS_DTS_I2C case.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-31 09:09:36 -06:00
Kumar Gala be0d753721 led: lp5562: Remove dts_fixup.h
Since the lp5562 led driver still supports both DTS and non-DTS
configuration, we update the code to use DT_<COMPAT>_<INSTANCE>
defines for the CONFIG_HAS_DTS_I2C case.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-31 09:09:36 -06:00
Kumar Gala e76ea6cf9d rtc: stm32: Remove trivial endif comment
Removed the endif comment as the Kconfig symbol it referenced didn't
exist.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-31 09:06:59 -06:00
Wayne Ren 1e392fbd0a drivers: uart_ns16550: remove soc specific codes and bug fixes
* remove soc specific codes
* optimize the caculation of baudrate.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-01-31 09:03:41 -05:00
Wayne Ren c48971cc61 driver: arcv2_timer0: fixes and optimize the timer driver
* MIN_DELAY: 1024 -> 512
* optimzie some code sequence
* fix a bug in setting the new timer limit value
   * case: before set limit register with new value,
     if counter rolls back to 0, the limit value should be
     adjusted.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-01-31 06:37:32 -05:00
Vincent Wan 11b4b6f660 drivers: wifi: simplelink: Add handling for unknown root CA
Error code SL_ERROR_BSD_ESECUNKNOWNROOTCA is returned from sl_Connect()
when the root CA used is not part of the certificate catalog on the
network processor. We should warn the users about this and continue on,
given the connection is successful.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-01-31 06:36:08 -05:00
Vincent Wan f1619beab9 drivers: wifi: simplelink: socket() should return non-zero fds
simplelink_socket() is not returning non-zero socket file descriptors
when it succeeds. This leads to socket() to always return socket fd 0,
even when the network processor returns a non-zero fd.

This commit fixes simplelink_socket() to return the correct socket fd
when it succeeds in getting one from the network processor.

Fixes #12650

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-01-31 06:36:08 -05:00
Aurelien Jarno d0afacc6b4 display: ssd1673: replace k_busy_wait by k_sleep
The SSD1673 driver currently use k_busy_wait to wait for the
controller to finish the execution of a commmand. However a display
update command can take from a few hundreds of ms (default LUT) to
almost a second (initial LUT). k_busy_wait is just a spinning loop,
which prevents all the threads with lower priority to not be executed
during that time. That could be the case for example of the shell or
the log thread.

As the timing is not critical, it's better to use k_sleep instead,
allowing the CPU to process other threads. In the long term it might
even be better to use an interrupt there, but might not be that easy if
we want to support to various SoCs that can be connected to such a
display.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-31 06:34:05 -05:00
Daniel Leung d0ad419737 timer: xtensa: restore smp_timer_init()
The smp_timer_init() was removed during timer re-write.
This results in undefined references error during compilation
when CONFIG_SMP=y. So add it back so we can compile for SMP.
The logic is updated from the previous version to the latest
in the driver.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-01-31 06:15:39 -05:00
Kumar Gala a3682f67d4 audio: mpxxdtyy: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert mpxxdtyy driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-31 03:46:04 -06:00
Erwan Gouriou a985e03349 drivers/interrupt_controller: stm32: Use LL API
exti driver implementation does not fit all SoCs because
some EXTI ip does not match stm32_exti register map provided.
Instead of providing exti register map for all SoCs, use LL API
which abstracts IP variations and enable uniform use of the drivers
on all STM32SoCs.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-01-31 03:18:36 -06:00
Piotr Mienkowski a148e11e2a drivers: uart_gecko: use DT_<COMPAT>_<INSTANCE>_<PROP> defines
Use the new DT_<COMPAT>_<INSTANCE>_<PROP> defines to instantiate
devices. This commit adds also ability to define individual pin
locations on SoC series that support the feature. Definitions of GPIO
pins assigned to a given location have been moved from soc_pinmap.h file
to board DTS file.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-01-31 03:14:51 -06:00
Maureen Helm 3c44137447 drivers: gpio: Validate pin number before indexing array in mcux drivers
Validates the gpio pin number before using it to index into a
memory-mapped register array. Otherwise, a user could send a high pin
number and cause an out-of-bounds access.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-01-31 03:13:15 -06:00
Kumar Gala 1d210dc2d8 sensor: adxl372: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert adxl372 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 17:51:25 -06:00
Kumar Gala 8de6778e90 sensor: lis2dh: Fix gcc8 compiler warning
We get the following warning with sdk-ng:

	drivers/sensor/lis2dh/lis2dh.c:210:38: error: bitwise comparison
	always evaluates to false [-Werror=tautological-compare]

	if ((value & LIS2DH_LP_EN_BIT_MASK) == 1 && ...
                                      ^~
The test needs to be:
	(value & LIS2DH_LP_EN_BIT_MASK) == LIS2DH_LP_EN_BIT_MASK

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 17:19:41 -06:00
Kumar Gala 62704a52ed pinmux: remove pinmux dev
pinmux dev isn't really used or supported.  We only have one driver that
is implmeneted, and that driver isn't ever enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 16:29:40 -06:00
Kumar Gala 2cfefa5d42 gpio: mcux_igpio: Cleanup old CONFIG_ symbols
A number of CONFIG_ symbols should have been converted to DT_ defines
instead.  Clean that up for PORT2..PORT4.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 13:22:54 -06:00
Kumar Gala 352234e0b6 drivers: uart_nsim: Add device tree support
Add Device Tree support for uart nsim ARC driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 12:27:37 -06:00
Aurelien Jarno b73c9b32e8 drivers: eth: gmac: fix IRQ names following import of latest HAL
Previous SAM E70 HAL version was patched by commit 4dcfc8706 ("Add
missing interrupt number definitions") to add missing interrupt
definitions for SAM GMAC Priority Queues. This has been fixed in the
latest HAL by using a slightly different name. This patch updates the
driver accordingly.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-30 10:43:45 -06:00
Aurelien Jarno 8a7e7407d0 drivers: flash: SAM E70: fix warnings when built with newlib
off_t is int with the minimal libc and long with the newlib libc. The
log messages are assuming that off_t is int, therefore this causes
warnings when building with newlib.

Fix that by casting the offset to the "longer" type, ie long.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-30 10:27:09 -06:00
Michael Scott 1e0a7116bd drivers: modem: wncm14a2a: allow more time for getting IMEI data
Every now and then the 100ms delay for collecting IMEI data from the
modem, wasn't long enough and this presents a bad user experience.

Let's set it to 500ms which seems to be working all the time.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-30 10:25:52 -06:00
Michael Scott 4fcab1ef1a drivers: modem: wncm14a2a: wait for modem init
During development of the WNC-M14A2A modem driver, I felt like the
initialization took too long to make the user wait.  However, due
to the addition of other drivers such as OpenThread where delays
during startup are noticable, the modem startup time isn't so bad.

Let's remove the delay work which allows Zephyr to startup before
the modem is fully initialized.

NOTE: This also fixes a long standing bug where samples using the
modem would never know when it was ready (without waiting for the
interface up event).  This change makes it always ready once the
sample starts.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-30 10:25:52 -06:00
Kumar Gala 4f334970ad sensor: adt7420: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert adt7420 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 08:08:03 -06:00
Aurelien Jarno 4575f44337 drivers: eth: gmac: get rid of descriptors helpers
Now that the descriptor lists are in non-cached memory, the helpers are
just accessing the w0 or w1 members of the structure. Just drop them and
access the members directly.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-30 08:40:00 -05:00
Aurelien Jarno d144639e47 drivers: eth: gmac: use non-cached memory for descriptor lists
Atmel SAM Ethernet module is using a scatter-gather technique to
exchange data with the Ethernet driver. To communicate the location
of the data buffers the driver sets-up a so called descriptor list. This
is effectively a place in RAM containing a sequence of 32-bit words
representing buffer location and its status.

Currently the cache coherency is handled using cache clean or
invalidate. Unfortunately this strategy only works correctly when the
corresponding data size is a multiple of the cache line. This is not
the case here and might lead to data loss or corruption.

Instead of using cache operations, this patch moves the descriptor
listed to the recently added non-cached memory region, as recommended by
ATMEL. A data synchronisation barrier is still required for writes, as
the non-cached memory is defined with TEX=1, i.e. it is not strongly
ordered. The descriptor lists alignment can be decreased to 4 bytes, as
required by the SAM Ethernet module.

The RX/TX buffer are left unchanged, still managed by cache operations.

Fixes #9812

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-30 08:40:00 -05:00
Aurelien Jarno 138306598d drivers: eth: gmac: drop wrong cache clean operation
The RX buffer accounting list is not a list shared with Ethernet device,
therefore there is no need to run a cache clean operation on it.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-30 08:40:00 -05:00
Kumar Gala cdc1b1f103 sensor: ccs811: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert ccs811 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 02:53:35 -06:00
Michael Scott 3588b94b06 drivers: serial: mcux: Introduce support for HW flow control
Now that a hw-flow-control DTS binding has been added for MCUX uart,
let's check for the DT_ define and enable support in the MCUX HAL
layer.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-30 02:53:12 -06:00
Kumar Gala 5c640cd0b5 audio: tlv320dac310x: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert tlv320dac310x driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 19:24:23 -06:00
Kumar Gala d7b7dbd910 sensor: apds9960: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert apds9960 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 16:03:21 -06:00
Kumar Gala 1300f5bd9e sensor: ms5837: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert ms5837 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 15:26:28 -06:00
Kumar Gala d0aca3b92c display: ili9340: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert ili9340 display driver to use new defines so we can remove
the dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 15:25:46 -06:00
Kumar Gala 3e8fc3c0c1 modem: wncm14a2a: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert wncm14a2a driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 14:21:56 -06:00
Kumar Gala fe8edc2884 display: ssd1306: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert ssd1306 display driver to use new defines so we can remove
the dts_fixup.h code for it.  Also dropped "-i2c" from compatible.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 14:21:32 -06:00
Kumar Gala 3b42943fe7 display: ssd1673: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert ssd1673 display driver to use new defines so we can remove
the dts_fixup.h code for it.  Also dropped "-spi" from compatible.

Fix up references in reel_board dts and sample.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 14:21:06 -06:00
Kumar Gala 003bdb5fb6 led_strip: lpd880x: Add Device Tree support
Convert the lpd880x driver to use device tree and new DT_<COMPAT>
defines.  Support both LPD8803 & LPD8806 device tree compats.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 12:04:07 -06:00
Martin Benda 9653e15139 drivers: timer: Add RTC-based system timer for Atmel SAM0 series MCU
Add sam0_rtc_driver that implements system timer API on top of the RTC
and can be used as a replacement for the default systick timer.

Signed-off-by: Martin Benda <martin.benda@omsquare.com>
2019-01-29 17:58:05 +01:00
Peter A. Bigot 5147ab74da drivers: sensors: hts221: move static definition out of header
This belongs in the implementation file that references the array, since
the header is included in multiple files.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-29 17:50:02 +01:00
Peter A. Bigot 4cd19eaeee drivers: sensor: hts221: correct bit for CTRL_REG1.BDU
Setting bit 3 instead of bit 2 modifies a reserved section of the
register, with the impact that the ODR is not as configured.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-29 17:50:02 +01:00
Peter A. Bigot 9f15116fd7 drivers: sensor: hts221: correct default log configuration
Incorrect symbol used for default.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-29 17:50:02 +01:00
Kumar Gala ae3abda801 led_strip: apa102: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert apa102 led_strip driver to use new defines so we can remove
the dts_fixup.h code for it.

Also update the driver to set the slave spi address as specified by the
device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 08:06:07 -06:00
Robert Lubos e0d4036f53 drivers: ieee802154: nrf5: Align to new radio driver API
Align ieee802154_nrf5 driver to a new radio driver API.
Utilize new radio driver features (CCA).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-01-29 10:37:47 +01:00
Aurelien Jarno 33dae59a57 drivers: eth: gmac: fix race condition in packet reference counting
The SAM E70 GMAC ethernet driver reference a packet with net_pkt_ref()
when queueing a packet, and unreference it with net_pkt_unref() in the
ISR when it has been fully sent.

The call to net_pkt_ref() is done just after re-enabling the
interruptions, so there is however a small race condition that might
cause the packet to be unreference before being referenced. This is
only theoretical and has not been seen in practice.

Fix that by moving the call to net_pkt_ref() just before re-enabling
the interruptions.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-29 09:23:52 +02:00
Daniel Glöckner d678f309b8 net: pkt: convert remaining users of ref to atomic_ref
The previous commit replaced the net_pkt element ref with an element
atomic_ref. CI tests turned up more places where ref was used directly.
This commit converts them to use the new element.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
2019-01-29 09:22:14 +02:00
Paul Sokolovsky 364751e029 drivers: eth_mcux: Optimize check if received frame too large
For some reason, there was sequence like:

1. Get size of RX packet.
2. Allocate pkt buffer.
3. Check if the size of RX packet is too large, then deallocate pkt
buffer and error out.

Instead, reorder operations to check size before allocating buf.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-29 09:18:43 +02:00
Maureen Helm 605e599b1a ext: mcux: Add HAS_MCUX_ENET config
Adds a new config HAS_MCUX_ENET to constrain which socs can enable the
mcux ethernet driver. This will prevent users from enabling the driver
on socs like kl25z or kw41z which do not have ethernet mac hardware.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-01-28 21:21:01 -05:00
Armando Visconti c788aa5254 drivers/audio: Add support to ST digital microphones (MPxxDTyy)
This driver supports ST Microelectronics digital pdm microphones
(MPxxDTyy) connected through different peripherals. Currently only
I2S is supported.

The driver makes use internally of the OpenPDM2PCM library
to convert the PDM audio stream to PCM. Currently the
oversampling factor is fixed to 64.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 11:57:25 -06:00
Kumar Gala f054ba2b65 flash: w25qxxdv: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert w25qxxdv driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-28 10:40:31 -06:00
Kumar Gala 2492d52f5c ieee802154: cc2520: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert cc5250 driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-28 10:40:14 -06:00
Kumar Gala e0cd0c2b67 wifi: winc1500: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert winc1500 driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-28 10:39:59 -06:00
Armando Visconti 42c7e8873c driver/sensor: lis3mdl: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS3MDL driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Armando Visconti a3ae11f897 driver/sensor: lis2mdl: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS2MDL driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Armando Visconti 5ad0d27bd1 driver/sensor: lsm6dsl: Fix attribute setting for gyroscope fs
The API for setting the gyroscope full scale attruibute requires
the argument in radians/s.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Armando Visconti c81efe25d5 driver/sensor: lsm6dsl: align driver to auto-generated dts macros
Use auto-generated device tree macros in LSM6DSL driver to avoid
usage of dts.fixup code for it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-28 10:01:19 -06:00
Georgij Cernysiov 26ab183ede drivers: pinmux: stm32: st: add L4 UART4 AF on PC10 and PC11
Added UART4 alternate pin function for L4 µC for PC10 and PC11.
Corrected naming of previously defined UART4 TX and RX defines.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-01-28 09:54:00 -06:00
Johann Fischer 65087aa99e drivers: hdc1008: add macros for manufacturer and device IDs
Add macros for HDC1008 manufacturer and device IDs.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-01-26 12:08:52 -05:00
Johann Fischer f36fe23e65 sensor: hdc1008: convert to DT_<COMPAT>_<INSTANCE> defines
Convert hdc1008 sensor driver to use new defines.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-01-26 12:08:52 -05:00
Georgij Cernysiov bed7fb3df0 drivers: modem: modem receiver dependencies adaptation
Moved UART interrupt dependencies from concrete driver to
the modem receiver as it uses UART interrupt functions within.
This allows developing other UART interrupt based modems without
the need to depend on the aforementioned features explicitly.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-01-25 17:36:59 -05:00
Michael Scott 13c794bc1c serial: RV32M1: introduce lpuart driver / DT bindings
Add a UART driver.

Signed-off-by: Michael Scott <mike@foundries.io>
Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-01-25 11:59:46 -05:00
Michael Scott 0f314ebdda gpio: RV32M1: introduce gpio driver / DT bindings
Add a GPIO driver.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-25 11:59:46 -05:00
Michael Scott cdb1714c6c pinmux: RV32M1: introduce pinmux driver / DT bindings
Add a pinmux driver.

Signed-off-by: Michael Scott <mike@foundries.io>
Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-01-25 11:59:46 -05:00
Marti Bolivar 58d8afb476 interrupt_controller: RV32M1: add intmux driver / DT bindings
Add a level 2 interrupt controller for the RV32M1 SoC. This uses the
INTMUX peripheral.

As a first customer, convert the timer driver over to using this,
adding nodes for the LPTMR peripherals. This lets users select the
timer instance they want to use, and what intmux channel they want to
route its interrupt to, using DT overlays.

Signed-off-by: Marti Bolivar <marti@foundries.io>
Signed-off-by: Mike Scott <mike@foundries.io>
2019-01-25 11:59:46 -05:00
Michael Scott 521f4778a1 clock_control: RV32M1: introduce PCC driver / DT bindings
Add a Peripheral Clock Controller (PCC) driver. This gates and ungates
clocks to various peripherals on the SoC.

Signed-off-by: Michael Scott <mike@foundries.io>
Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-01-25 11:59:46 -05:00
Marti Bolivar 502d306630 soc: riscv32: add RV32M1 SoC as openisa_rv32m1
The OpenISA RV32M1 SoC has four CPU cores. Two of these are RISC-V
32-bit cores, which are named "RI5CY" and "ZERO-RISCY". (The other two
cores are ARM Cortex-M0+ and -M4.) This patch adds basic SoC
enablement for the RISC-V cores:

- basic dtsi, to be extended as additional drivers are added
- SoC definition in soc/riscv32/openisa_rv32m1 for RI5CY / ZERO-RISCY
- system timer driver for RI5CY, based on LPTMR0 peripheral

The timer driver will be generalized a bit soon once proper
multi-level interrupt support is available.

Emphasis is on supporting the RI5CY core as the more capable of the
two; the ZERO-RISCY SoC definitions are a good starting point, but
additional work setting up a dtsi and initial drivers is needed to
support that core.

Signed-off-by: Marti Bolivar <marti@foundries.io>
Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-25 11:59:46 -05:00
Marti Bolivar 0aa87e15bb drivers: interrupt_controller: multi-level improvements
Some extensions to the multi-level interrupt controller are required
to support SoCs with more than four level 2 interrupt "aggregators".

Extend existing support to allow at most 8 level 2 or level 3
aggregators. Use Kconfig macro templates to cut down on boilerplate.
Try to clarify some aspects of the Kconfig help while we're at it, and
change the type of options which count things or are table offsets
from "hex" to "int", so that the generated .config is easier to read.

Finally, make some improvements to gen_isr_tables.py while we are
here. In particular, move some assignments around to cut down on
duplicated work, don't check for symbols we know must exist, and
improve the debug logging output's readability.

Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-01-25 11:59:46 -05:00
Tomasz Bursztyka ea5d01b41c drivers/gpio: Act relevantly if GPIO_INT is an unsupported flag
Using right error code, and no need to populate callback related API
functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-01-25 11:24:29 -05:00
Tomasz Bursztyka 04d9d57a63 api/gpio: Controller may not support GPIO_INT at all
It's not an error if a driver does not implement callback related
function. Let's return -ENOTSUP relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-01-25 11:24:29 -05:00
Tomasz Bursztyka 064f5f0cef drivers/gpio: Manage callback addition/removal properly
It needs to verify if the callback was not already installed, and if so:
if is was in controller's list.
It should return an error in case the node is not found though it was
requested to be removed.
If already inserted, it will be silently removed but added again, to
avoid circular list as stated in the bug.

Fixes #11394

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-01-25 11:24:29 -05:00
Jukka Rissanen 1cba0161ed net: websocket: Remove the websocket as HTTP APIs are removed
Remove the experimental websocket code as it uses HTTP APIs
which are being removed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-01-25 11:21:20 -05:00
Kumar Gala 61cb8b6c4f drivers: wdog: cmsdk: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert cmsdk driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-25 08:55:06 -06:00
Kumar Gala 4b6cec44ff drivers: uart: cmsdk_apb: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert cmsdk_apb driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-25 08:55:06 -06:00
Kumar Gala da474efe80 drivers: i2c: i2c_sbcon: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert i2c_sbcon driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-25 08:55:06 -06:00
Erwan Gouriou 14dcd13069 drivers/interrupt_controller: stm32: Complete driver factorization
Complete code factorization in stm32 exti drivers.
Add return value in case line is not implemented.
Except returned error code, refactor has been done iso-feature
compared to previous code. Hence error is reported only when
support was not available on previous series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-01-24 09:38:38 -06:00
Erwan Gouriou bd78d0ed37 drivers/interrupt_controller: stm32: Complete driver factorization
Complete code factorization in stm32 exti drivers.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-01-24 09:38:38 -06:00
Armando Visconti 797ecde958 sensor/lis2mdl: use kconfig named choice for TRIGGER_MODE
Use Kconfig named choice for TRIGGER_MODE in order to easy
up the trigger mode selection in default configurations
for boards using this sensor driver.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 09:38:08 -06:00
Armando Visconti 3ab122d293 driver: sensor: lps22hb: fix the temp sensor fractional value
Fix the temperature sensor fractional value.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 09:38:08 -06:00
Armando Visconti fe6e3b330c drivers/i2s_ll_stm32.c: pass proper PLLR param when setting I2S PLL
The PLLR parameter in LL_RCC_PLLI2S_ConfigDomain_I2S() API should
be selected among the following list of (already shifted) values:

  *         @arg @ref LL_RCC_PLLI2SR_DIV_2
  *         @arg @ref LL_RCC_PLLI2SR_DIV_3
  *         @arg @ref LL_RCC_PLLI2SR_DIV_4
  *         @arg @ref LL_RCC_PLLI2SR_DIV_5
  *         @arg @ref LL_RCC_PLLI2SR_DIV_6
  *         @arg @ref LL_RCC_PLLI2SR_DIV_7

This commit fixes PR #12609.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 09:35:53 -06:00
Kumar Gala 668443bc74 drivers: eth_enc28j60: Fix CS GPIO support
We now generate CS GPIO defines from the DTS that we can utilize.  We
needed to slightly update the #defines in the driver from:

DT_MICROCHIP_ENC28J60_0_CS_GPIOS_{PIN,CONTROLLER} to
DT_MICROCHIP_ENC28J60_0_CS_GPIO_{PIN,CONTROLLER}

Fixes #12640

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-24 08:38:27 -05:00
Armando Visconti aca8ae3fd4 driver/sensor: use lis2dh as common driver among multiple sensors
Share lis2dh driver among few accelerometer sensors that has
same register interface: LIS2DH, LIS3DH, LSM303DLHC, LIS2DH12,
LSM303AGR.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 07:26:16 -06:00
Armando Visconti e35f36966b driver/sensor: lis2dh: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS2DH driver to avoid
usage of dts.fixup files. The triggered interrupt part has been
slightly hacked to automatically understand whether only int1 is
configured or both int1 and int2.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 07:26:16 -06:00
Kumar Gala eaafdc85fc wifi: eswifi: Use generated SPI CS define
Move to using the generated DT_INVENTEK_ESWIFI_ESWIFI0_CS_GPIO_pin and
DT_INVENTEK_ESWIFI_ESWIFI0_CS_GPIO_CONTROLLER defines and drop the
DT_ESWIFI0_CS_GPIOS_PIN & DT_INVENTEK_ESWIFI_ESWIFI0_CS_GPIO_PIN from
dts_fixup.hl

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 18:12:24 -06:00
Peter A. Bigot ac36886e62 drivers: nrf: timer: add inline qualifier where inlining is intended
Not necessary with gcc, and Zephyr is inconsistent about using the
qualifier, but making the intent explicit is a good thing.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 21:38:09 +01:00
Peter A. Bigot 084363a0dc drivers: timer: nrf: refactor for speed and correctness
The existing implementation of z_clock_set_timeout() calculates the
compare value based on a complex series of operations including an
unconditional integer division and multiplication intended to ensure the
compare value is aligned to a tick boundary.  On the nRF51 this division
requires a call to an outline function with a data-dependent execution
time.

In the common case where the timeout is set less than one tick past the
last observed tick the devision can be elided, as can several extra
operations intended to deal with fractional ticks.

The code also failed to account for a ticks-per-cycle that violated the
minimum delay required to guarantee a compare value would result in a
match without wrapping.  The minimum delay was also unreasonably long
(about 1 ms).  Reduce it to a more reasonable value to allow for a
higher ticks-per-second, and diagnose attempts to set the tick frequency
above the supported maximum (8192 Hz).

Finally, move the parts of the compare calculation that are not
dependent on the live counter value out of the locked region.

Prior to this change the observed time between the irq_lock() and
irq_unlock() in z_clock_set_timeout() on the nRF51 ranged between 5 us
and 8 us.

With the revised algorithm the observed lock duration is between 2.16 us
(1024 Hz) and 2.88 us (100 Hz) in the common case that the compare is
set within the current tick.  If the compare is set late the duration
will be higher, but no greater than the previous implementation.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 21:38:09 +01:00
Peter A. Bigot 71882ff8c4 drivers: timer: nrf: drop unnecessary counter mask
The RTC COUNTER register doesn't care that it receives a value larger
than it can hold; it'll discard the bits internally.  No need to spend
cycles doing it manually.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 21:38:09 +01:00
Peter A. Bigot 4b24e88fa4 drivers: timer: nrf: use irq_lock instead of spinlock
spinlock gains us nothing on an architecture that doesn't support SMP.
Use the standard irq_lock() API so when we search for conditions that
may decrease ISR responsiveness we can find them.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 21:38:09 +01:00
Paweł Zadrożniak a0e2737aff drivers: nordic: usb: USBD event handling rework
Some of the events from USBD peripheral (i.e. cable disconnect)
were handled in IRQ context and some of them (i.e. ep r/w events) in
system workqueue (inherited from initial driver implementation).
This may lead to race condition in some specific situations.
Currently, all of the events are enqueued in ISR and processed in
workqueue. Driver is reinitialized on queue overflow and queue size
is configurable in KConfig.

Fixes #12016

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2019-01-23 16:55:15 +01:00
Ioannis Konstantelias 5151e8a094 boards: nucleo_l496zg: Add pwm mapping and RTC
Supported PWM at pins A0, D3, D5 and D6 which are also Arduino
compatible. Also the onboard red LED can be used with PWM.

The basic/{fade_led, blink_led} samples to apply to this board
seemlessly and operate on the onboard red LED.

Also supported RTC.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-01-23 09:18:35 -06:00
Benoit Leforestier 2a1c94cbc3 Driver: Serial STM32: Fix use of TXE IRQ
In case of TX IRQ pending,
uart_stm32_irq_is_pending() function always return 0,
because "is TXE enabled ?" is checked instead of "is TC enabled ?".

Signed-off-by: Benoit Leforestier <benoit.leforestier@gmail.com>
2019-01-23 04:30:58 -06:00
Erwan Gouriou 94bf757d68 drivers/gpio: stm32: Fix gpio_stm32_configure
Behavior of function gpio_stm32_configure has been modified
during driver factorization. Various gpio settings (speed, mode, ..)
are applied conditionally while they used to be applied in sequence,
unconditionally before this change. As a consequence some
combinations of configurations are no more applied (like speed for
alternate mode). This of course has impact in some use cases.
Rework functions in order to apply settings unconditionally. Take
advantage of the change to reduce code size.

This change impacts all SoCs except F1 series.

Fixes #12544

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-01-23 04:03:30 -06:00
Harry Jiang 9614fb3011 drivers: stm32: fix the STM32F1 series gpio configuration
This patch fix the STM32F1 series gpio configuration issue
for the pin number large than 7.

Signed-off-by: Harry Jiang <explora26@gmail.com>
2019-01-22 12:25:51 -06:00
Mieszko Mierunski 29c71b1fec drivers: nrf: Rework UART shim to support async UART API.
Add support for async UART API.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-01-22 18:54:12 +01:00
Mieszko Mierunski 117c28aad9 api: uart: Add new asynchronous UART API.
Added new UART API, that allows for longer transmissions, leaves
IRQ handling on driver side and allows for DMA usage.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-01-22 18:54:12 +01:00
Pawel Dunaj bfb23cc5de drivers: usb: Do not enable non-existing USB endpoints
Number of USB endpoints is set via DTS, nevertheless USB driver
tries to enable all endpoints as it uses number of endpoints from
nRFx.
This commit makes driver enable only these endpoints that were
enabled in DTS.

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2019-01-22 17:44:17 +01:00
Armando Visconti fdce786c07 driver/sensor: add LIS2DS12 sensor support
Add support to STM LIS2DS12 3-axis accelerometer driver.
The driver support I2C and SPI bus communication and both
polling and drdy trigger mode.
Currently it uses high resolution only as power mode.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-22 08:48:40 -06:00
Aurelien Jarno 87cf468959 drivers: eth: gmac: fix TX descriptor write process
The SAM E70 Ethernet driver uses scatter gather DMA to transmit data.
Each fragment of a network packet is mapped from a set of descriptors
that is used by the controller to do the DMA transfer. Each descriptor
contain an address and a length/status. The important status bits are
GMAC_TXW1_LASTBUFFER to indicate the last fragment of a packet and
GMAC_TXW1_USED to indicate that a descriptor has been processed by the
controller.

When starting a transmission, the controller start at the descriptor
after the last one that has been processed. If the descriptor is NOT
flagged by GMAC_TXW1_USED, it sends a first packet by sending all the
fragments up to a descriptor flagged with GMAC_TXW1_LASTBUFFER. The
first descriptor of a packet *and only the first descriptor of a packet*
is then modified to flag it with GMAC_TXW1_USED and to provide a status
(mostly related to errors and checksum offloading). It then continues
with the next packet and so on and only stops if the next descriptor
after GMAC_TXW1_LASTBUFFER is flagged with GMAC_TXW1_USED.

Therefore in order for the controller to stop processing descriptors,
the strategy is to flag the next descriptor after the last fragment to
be sent with GMAC_TXW1_USED. When the next packet has to be queued, the
flag can be removed before starting a transmission.

This is what is currently done in the current driver. However there is a
small race condition in the implementation: if packets are queued fast
enough, the controller is still sending the fragment of the previous
packet when the descriptor are written. When writing the first
descriptor, the GMAC_TXW1_USED flag is removed. This is done after
writing the address (with a memory barrier) so that looks safe. However
given that the GMAC_TXW1_USED flag is only added by the controller to
the first descriptor of a packet it means the next descriptor might
have it cleared. In that case the descriptor is processed, and a junk
packet is sent. That also desynchronize eth_tx and tx_complete as one
or more packets than expected are transmitted.

In order to fix that the strategy is slightly changed to initially write
the first descriptor with the GMAC_TXW1_USED flag set. Once all the
descriptors from the packet are written the bit is cleared (after a
memory barrier). Then the transmission can be started safely.

The patch also does a small optimization writing the next descriptor
with only the GMAC_TXW1_USED bit set instead of setting this bit. As
this will be a non-cached area, it's better avoiding a read followed
by a write if not necessary.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-22 15:40:05 +02:00
Aurelien Jarno afbee4c96a drivers: eth: gmac: conservatively compute the number of descriptors
If a pkt has more frags than the number of TX descriptors, we end up in
a deadlock situation, as the whole packet and thus all the frags have to
be mapped in the descriptors at once. That is why the number of
descriptors is defined as CONFIG_NET_BUF_TX_COUNT + 1.

This wrongly assumes that only TX buffers can be used to send data,
however the packets might also come from the RX buffers, like for
example with ICMPv4.

Therefore define the number of descriptors as the maximum of
CONFIG_NET_BUF_RX_COUNT + 1 and CONFIG_NET_BUF_TX_COUNT + 1. This fixes
a deadlock when CONFIG_NET_BUF_TX_COUNT is much smaller than
CONFIG_NET_BUF_RX_COUNT.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-22 15:40:05 +02:00
Aurelien Jarno 18b07e09e0 drivers: eth: gmac: drop TX timeout handling
The current SAM E70 Ethernet driver sometimes get stuck if the stack
has to send 2 packets in a row, for example an ack for the just received
data + answer data.

The problem is the following one:
1) The first packet goes through eth_tx, one tx_desc_sem semaphore is
   taken, and the tx_timeout_work delayed work is submitted.
2) The second packet also goes through eth_tx, another tx_desc_sem
   semaphore is taken, and the tx_timeout_work delayed work is not
   started because there is already one already submitted.
3) The first packet has been sent, one tx_desc_sem semaphore is given
   and the tx_timeout_work delayed work is cancelled.
4) The second packet has been sent but given the delayed work has
   already been cancelled, tx_completed is not called: the tx_desc_sem
   semaphore is not given back and the network packet is not
   unreferenced.

The whole timeout concept probably has to be reworked. In the meantime
it is probably better to just drop the timeout code instead of keeping
the driver broken. We can only get stuck on the TX path if there is a
bug in the driver or a hardware malfunction. It might happen, but with
the less probability then the current hangs. In addition it just hides
the real issues and prevent them to be fixed.

This commit therefore just remove the timeout code in the TX path.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-22 15:40:05 +02:00
Anas Nashif d9ec5eca24 hpet: remove HPET_TIMER_*_EDGE and HPET_TIMER_LEVEL_*
This option is not used anywhere and was removed when the hpet driver
was rewritten.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-22 07:45:22 -05:00
Anas Nashif 1d11945739 hpet: remove unused HPET_TIMER_LEGACY_EMULATION
This option is not used anywhere and was removed when the hpet
driver was rewritten.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-22 07:45:22 -05:00
Anas Nashif 2621f6dc40 hpet: remove unused HPET_TIMER_DEBUG option
This option is not used anywhere and was removed when the hpet driver
was rewritten.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-22 07:45:22 -05:00
Anas Nashif 6d5e0a3db0 interrupt_controller: cleanup dependencies in kconfig
Cleanup dependencies in Kconfig and convert some top-level options to
menuconfig. guard all dependent options with if instead of using
'depends on' for readibility.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-22 07:45:22 -05:00
Anas Nashif 5aa44e6108 timer: cleanup dependencies in kconfig
Cleanup dependencies in Kconfig and convert some top-level options to
menuconfig. guard all dependent options with if instead of using
'depends on' for readibility.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-22 07:45:22 -05:00
Paul Sokolovsky 416d397233 drivers: eth_mcux: By default use 1 buffer each for hardware RX/TX
It was reported, and confirmed by multiple parties that default
CONFIG_ETH_MCUX_RX_BUFFERS=2 under some packet load leads to
1s and increasing packet processing delay and eventual deadlock.
No reports were about CONFIG_ETH_MCUX_TX_BUFFERS=2, but be on safe
side and just set that to the minimal value as the current default,
to allow us to have good conservative base to test various networking
stack issues.

Fixes: #3132

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-21 12:40:33 +02:00
Andrzej Głąbek 055a60e797 drivers: pwm: nrf: Correct dependency of PWM_NRFX Kconfig option
Correct it so that it is possible to use PWMs on nRF9160 as well,
not only on nRF5 family SoCs.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-21 10:13:34 +01:00
Andrzej Głąbek 37fbff6179 drivers: nrf: Adjust clock_control and timer drivers for nRF9160
Minor adjustments are done to the nRF clock_control and rtc_timer
drivers to make them usable on nRF9160 as well.
The arm_irq_vector_table test code is modified only because it uses
the function that has been renamed in the nrf_rtc_timer driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-21 10:13:34 +01:00
Andrzej Głąbek 0cc8f302bf drivers: clock_control: nrf: Use IRQ number symbol generated from DT
Use the symbol generated from DT so that it is common for nRF9160
and nRF5 family SoCs. To avoid artificial renaming of CLOCK_POWER_IRQn
to POWER_CLOCK_IRQn.

For nRF5 family SoCs clock nodes were not defined so far, thus they are
added so that the proper DT symbol is generated for them as well.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-21 10:13:34 +01:00
Andrzej Głąbek 61fe47ad15 drivers: serial: nrfx: Add support for UARTE2 and UARTE3
Extend the uart_nrfx_uarte driver to support all UARTE instances
available on nRF9160.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-21 10:13:34 +01:00
Andrzej Głąbek 8ab0a14170 drivers: i2c: nrfx: Add support for TWIM2 and TWIM3
Extend the i2c_nrfx_twim driver to support all TWIM instances
available on nRF9160.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-21 10:13:34 +01:00
Paul Sokolovsky 483b9d609c drivers: eth_smsc911x: Add driver for SMSC9118 aka LAN9118 chip
As emulated by QEMU. SMSC9118 is compatible with SMSC9220 as used in
ARM MPS2 board, as well as SMSC9115/6/7/etc. devices.

Portions of the code are based on mbedOS code from its
targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/device/drivers/smsc9220_eth.c

eth_smsc9220_priv.h originally comes from Arm mbedOS file:

targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/device/drivers/smsc9220_eth.h

augmented with struct & defines from:

targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/device/CM3DS.h

and renamed as eth_smsc911x_priv.h to follow Zephyr conventions.

Then, following changes applied:

Changes to build under Zephyr, changes to use symbolic constants
and field access helpers, typo fixes, etc.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-19 11:59:29 -05:00
Loic Poulain 8a7b6ffaab wifi: eswifi: Add access point offload support
The eswifi controller is capable of acting as an Access Point.
Implement ap_enable/ap_disable methods.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-19 07:20:36 -05:00
Loic Poulain c893024184 drivers: wifi: eswifi: Fix mac address assignment
Use always valid mac pointer instead of a stacked local variable.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-19 07:20:36 -05:00
Loic Poulain 654d93999e wifi: eswifi: Add controller at command helpers
Create eswifi_at_cmd and eswifi_at_cmd_rsp helpers, allowing to send an
at command and parse the at response. These methods return success if
the response contains the OK* string. The eswifi_at_cmd_rsp method
extracts response content/size (DATA) on success.

*Response format is:
\r\n[DATA]\r\nOK\r\n>
Where DATA can be arbitrary (ASCII or not).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-19 07:20:36 -05:00
Alberto Escolar Piedras acefd36501 native_posix: Remove all references to the defunct legacy shell
Remove all references in the documentation and Kconfig options
to the legacy shell to avoid confusing users and developers

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-18 18:25:05 -05:00
Kumar Gala affc1ed253 sensor: bmi160: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert bmi160 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:53:53 -06:00
Kumar Gala 31dad5b411 sensor: vl53l0x: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert vl53l0x sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:52:14 -06:00
Kumar Gala 957c3009a6 sensor: max30101: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert max30101 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:50:12 -06:00
Kumar Gala 8b691f50ca led_strip: ws2182: Add Device Tree support
Convert the ws2812 driver to use device tree and new DT_<COMPAT>
defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 12:47:45 -06:00
Peter A. Bigot 12836d9280 drivers: sensors: sht3xd: support multiple devices and DT bindings
Add a configuration structure to sht3xd that holds instance-specific
parameters, implemented in a immutable statically allocated object
initialized with material from device tree binding aliases.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-18 09:43:14 -06:00
Peter A. Bigot ec6509504d drivers: sensors: sht3xd: uncrustify
Run this through the code formatter.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-18 09:43:14 -06:00
Peter A. Bigot 98cc93952d drivers: sensors: sht3xd: move object definitions out of header
These belong in the driver implementation file.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-18 09:43:14 -06:00
Kumar Gala 7b9bf08dce sensor: lps22hb: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert lps22hb sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 09:38:31 -06:00
Robert Lubos 0b93c68f79 net: sockets: Add fcntl to socket offloading API
Offload fcntl calls through socket offloading API.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-01-18 17:25:01 +02:00
Kumar Gala 717b647c30 ieee802154: mcr20a: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert mcr20a driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 09:06:10 -06:00
Kumar Gala 8f04f81e97 sensor: fxas21002: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert fxas21002 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-18 08:54:31 -06:00
Maureen Helm 395a92b36b clock_control: Add support for lpi2c clock in mcux ccm driver
Adds support for getting the lpi2c clock frequency in the mcux ccm
driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-01-18 06:49:35 -05:00
Maureen Helm d7dfa21391 drivers: i2c: Introduce mcux lpi2c shim driver
Adds a shim layer around the mcux lpi2c driver to adapt it to the zephyr
i2c interface. This shim driver leverages heavily from the mcux i2c shim
driver because the MCUXpresso SDK provides similar APIs for the i2c and
lpi2c peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-01-18 06:49:35 -05:00
Gil Pitney 7f956a9353 drivers: wifi: simplelink: add timeout for fast connect feature
The SimpleLink wifi driver enables the Fast Connect method of
WiFi provisioning, which allows the network coprocessor to
reconnect to a previously connected Access Point (AP) on
startup.

Previously, if Fast Connect failed to connect, any network
socket applications would inevitably fail, as there would have
been no wifi connection.

This patch adds a configurable timeout for the Fast Connect
feature, after which timeout, an error is logged informing
the user to manually reconnect to an AP.

Reconnection is typically accomplished by separately running the
wifi sample shell program.

Fixes: #11889

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2019-01-18 12:32:59 +02:00
Andrzej Głąbek 0906a51dac drivers: adc: Fix handling of invalid sampling requests
Commit aad21ecb31 introduced an incorrect
pattern of handling ADC sampling requests with invalid parameters in
both nRF ADC drivers. After discarding such request, the drivers do not
release properly the access lock and therefore become unusable.
Unfortunately, this pattern were later on copied in all other ADC
drivers in the source tree.
This commit adds the proper lock releasing in all the affected drivers.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-17 16:58:21 -05:00
Andrzej Głąbek 7c52bf9d0c drivers: adc: nrfx: Correct log module name in adc_nrfx_adc.c
Due to a copy-paste mistake, this driver used an incorrect module
name (adc_mcux_adc16) in log messages.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-01-17 16:58:21 -05:00
Kumar Gala 5431762769 sensor: fxos8700: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert fxos8700 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 13:29:46 -06:00
Kumar Gala 689ad43b62 sensor: hts221: Move GPIO to device tree
Move how we configure the DRDY gpio line to device tree from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 11:06:38 -06:00
Kumar Gala c77a322c6e sensors: hts221: Get I2C address from device tree
Change driver to get I2C address of sensor from the device tree like
most other sensor drivers that utilize device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 11:06:38 -06:00
Kumar Gala a5e8921de9 sensors: hts221: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert hts221 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-17 11:06:38 -06:00
Robert Lubos 635191ac8c net: ieee802154: Fix ack check
15.4 MHR is no longer set in net_buf pointed by net_pkt, but in a
separate net_buf, hence we need to check that net_buf now to
determine if we need to wait for ACK or not.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-01-17 11:16:26 +02:00
Pushpal Sidhu acd0e25384 serial: stm32: Implement configure and config_get api calls
Implement these two new api calls. Allows on-the-fly configuration
adjustment of uarts.

Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
2019-01-16 21:49:03 -05:00
Peter A. Bigot 522b9c7293 drivers: intel_gna: replace k_alert with work queue
This is the only use of the k_alert infrastructure in the Zephyr code
base.  See whether we can get rid of it.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-16 21:34:07 -05:00
Armando Visconti ab06ec63f9 drivers/i2c: stm32: (FIX) add mutex to lock bus
Add mutex to lock STM32 I2C bus in order to guarantee
that data transfers are atomic and have exclusive access
to the bus.
Issue has been found fetching data from multiple sensors
on I2C bus in a mixed context of thread and triggered
interrupt.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-16 21:33:49 -05:00
Kumar Gala efd31af624 sensors: lsm303dlhc: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert lsm303dlhc_accel & lsm303dlhc_magn sensor driver to use new
defines so we can remove the dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-16 21:33:16 -05:00
Andrei Gansari 4118b8843f drivers: eth_enc28j60: moved to dts
Driver for networking device Microchip ENC28J60 is used as SPI slave,
moved to DTS type definition. Samples echo_client and echo_server use
this device on Arduino 101 board.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-16 21:28:23 -05:00
Rajavardhan Gundi f5b60eeca8 Kconfig: spi_nor: Remove Erase configuration from Kconfig
Configuration of Erase command is specified in DTS. Hence
the corresponding changes in Kconfig are removed.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Rajavardhan Gundi 74895bc099 dts: spi_nor: Rename DT_SPI_NOR_SPI_SLAVE to DT_SPI_NOR_SPI_SLAVE_ID
The "_ID" suffix for DT_SPI_NOR_SPI_SLAVE better represents what it
is used for.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Rajavardhan Gundi 7d428bb0a8 flash: spi_nor: Remove Kconfig parameter for SPI_NOR_SECTORS
Number of sectors is now calculated from the flash density
i.e. (Flash size)/(sector size).

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Rajavardhan Gundi 75f6f1b279 drivers: flash: spi_nor: Enable Flash Page Layout and Map
This patch enables the support for FLASH_PAGE_LAYOUT and
FLASH_MAP for the generic spin nor flash driver.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Rajavardhan Gundi f885fd15bf DTS: flash: spi_nor: use DT_ for freq and other parameters
Use DT_ instead of CONFIG_ for spi freq, spi bus name, flash device
name and flash base address.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Kumar Gala be2b6f870d sensor: bme280: Converting to using device tree
Convert the BME280 driver to use device tree and new DT_<COMPAT>
defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-16 12:39:37 -06:00
Savinay Dharmappa 955781b896 boards: nios2: Add dts support for i2c
patch add dts suppoer for i2c.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-01-16 12:35:30 -06:00
Maureen Helm c80b564ec2 drivers: serial: Fix mcux lpuart instance 2
The mcux lpuart shim driver was updated in commit
20202902f2 to use DT_ prefix in all
defined labels not related to Kconfig, but instance 2 was missed.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-01-16 12:32:16 -06:00
Armando Visconti 16891af7a7 drivers/sensor: lis2dh: Fix LP Enable bit mask
Fix the value for Low Power Enable (LP_EN) bit mask.
(Issue described by Coverity CID #188734)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-16 12:27:05 -06:00
Erwan Gouriou e25d6a65ac drivers/pinmux: stm32: Clean up after gpio driver factorization
Clean up a left over from GPIO driver factorization.
Definition of GPIO_REG_SIZE and GPIO_PORTS_BASE do not need anymore
to be spread accross SoCs.
Put these definitions directly in STM32 pinmux driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-01-16 08:36:09 -06:00
Andy Gross 9cc4b59069 serial: Add Support for ARM PL011 UART
This patch adds a serial driver for the ARM PL011 IP block.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-15 15:40:37 -06:00
Varun Sharma 77c643a5a3 drivers: Modify drivers to use DEVICE_AND_API_INIT()
Modified drivers to use DEVICE_AND_API_INIT() instead of DEVICE_INIT()

This will make sure driver_api,is populated at build time and is exposed
to user space

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2019-01-15 10:39:34 -08:00
Ioannis Glaropoulos 052121ee7c drivers: clock control: rename Kconfig.nrf5 to Kconfig.nrf
Renaming Kconfig.nrf5 to Kconfig.nrf in the wake of extending
the use of the nRF clock control driver to both nRF5 and nRF91
SOC series.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-01-15 18:03:24 +01:00
Ioannis Glaropoulos 2e687653fa drivers: clock control: rename nrf5_power_clock source and header
This commit renames the nrf5_clock_control.h and
nrf5_clock_control.c files to nrf_clock_control.h and
nrf_clock_control.c, respectively, as they are used
in nRF9160 builds, as well.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-01-15 18:03:24 +01:00
Ioannis Glaropoulos 302a746bd6 drivers: clock control: nrf: rename CLOCK_CONTROL_NRF5 Kconfig symbol
This commit renames the CLOCK_CONTROL_NRF5 Kconfig symbol to
CLOCK_CONTROL_NRF. The change is required to aleviates confusion
when selecting the symbol in nRF9160 SOC definition.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-01-15 18:03:24 +01:00
Peter A. Bigot f3f8f96842 tests: i2c_slave_spi: update to proposed DT compatible naming
In driver and application code use the new device-tree values produced
by standard compatible-instance bindings.

As this code may be used as an example add a comment describing how the
binding instance number cannot be reliably used to distinguish multiple
instances.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-15 08:29:52 -06:00
Anas Nashif 937e45de74 drivers: spi_sam: initialize tx and rx
initialize both tx and rx in the spi_sam0 driver. Make the spi_sam
driver look the same by splitting the declaration into 2 lines.

Discovered with gcc 8.2

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-14 14:07:52 -05:00
Paweł Zadrożniak 480b728d52 drivers: usb: nordic: Fix IN transfer fragmentation
Currently, when usb_dc_ep_write is called, data is copied to the
internal buffer, hence the requirement for fragmentation, regardless
of low-level nrfx_usbd driver. This commit forces the fragmentation
and prevents potential internal buffer overflow. Adittional
fragmentation flag was added to prevent triggering status stage
(it is handled by hardware completely on nRF chips).

Fixes #12339

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2019-01-14 11:02:47 +01:00
Paul Sokolovsky c885cb533e net: buf: linearize: Get rid of useless memset()
net_buf_linearize() used to clear the contents of output buffer,
just to fill it with data as the next step. The only effect that
would have is if less data was written to the output buffer. But
it's not reliable for a caller to rely on net_buf_linearize() for
that, instead callers should take care to handle any conditions
like that themselves. For example, a caller which wants to process
the data as zero-terminated string, must reserve a byte for it
in the output buffer explicitly (and set it to zero).

The only in-tree user which relied on clearing output buffer was
wncm14a2a.c. But either had buffer sizes calculated very precisely
to always accommodate extra trailing zero byte (without providing
code comments about this), or arguably could suffer from buffer
overruns (at least if data received from a modem was invalid and
filled up all destination buffer, leaving no space for trailing
zero).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-12 15:24:29 -06:00
Andy Ross 3642f67b05 drivers/timer/hpet: Fix logic for !TICKLESS
When tickless was disabled, this inverted test would never fire the
first interrupt and the timer would be silent.  Just remove it.
There's no harm in unconditionally enabling a single timer interrupt
at boot.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross b69d0da82d arch/x86_64: New architecture added
This patch adds a x86_64 architecture and qemu_x86_64 board to Zephyr.
Only the basic architecture support needed to run 64 bit code is
added; no drivers are added, though a low-level console exists and is
wired to printk().

The support is built on top of a "X86 underkernel" layer, which can be
built in isolation as a unit test on a Linux host.

Limitations:

+ Right now the SDK lacks an x86_64 toolchain.  The build will fall
  back to a host toolchain if it finds no cross compiler defined,
  which is tested to work on gcc 8.2.1 right now.

+ No x87/SSE/AVX usage is allowed.  This is a stronger limitation than
  other architectures where the instructions work from one thread even
  if the context switch code doesn't support it.  We are passing
  -no-sse to prevent gcc from automatically generating SSE
  instructions for non-floating-point purposes, which has the side
  effect of changing the ABI.  Future work to handle the FPU registers
  will need to be combined with an "application" ABI distinct from the
  kernel one (or just to require USERSPACE).

+ Paging is enabled (it has to be in long mode), but is a 1:1 mapping
  of all memory.  No MMU/USERSPACE support yet.

+ We are building with -mno-red-zone for stack size reasons, but this
  is a valuable optimization.  Enabling it requires automatic stack
  switching, which requires a TSS, which means it has to happen after
  MMU support.

+ The OS runs in 64 bit mode, but for compatibility reasons is
  compiled to the 32 bit "X32" ABI.  So while the full 64 bit
  registers and instruction set are available, C pointers are 32 bits
  long and Zephyr is constrained to run in the bottom 4G of memory.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross f2d0591830 drivers/timer/hpet: Fix default IRQ
The HPET default is to deliver events on the same INTIn as the legacy
PIT IRQ, and in fact our code requires that because it uses the
"legacy routing" option.  So this isn't really a configurable and has
to be set correctly.  Do it right in the kconfig default instead of
forcing boards to set it.

(No, I have no idea where "20" came from either.)

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Paul Sokolovsky f3dce8a6e4 drivers: eth: stellaris: Enable automatic Ethernet support in QEMU
When used suitable config overlay, qemu_cortex_m3 with Ethernet
support can be started with just usual "make run".

An example of such overlay is included with samples/net/echo_server,
can be built and run with:

make BOARD=qemu_cortex_m3 \
    CONF_FILE="prj.conf overlay-qemu_cortex_m3_eth.conf" run

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-11 09:48:27 +02:00
Aurelien Jarno 2ff5d641f2 drivers: entropy: mcux_trng: get the base address from the device tree
Instead of getting the base address from the MCUX headers, use the base
address from the device tree.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-10 21:22:15 -06:00
Song Qiang 2fb616efbe soc: arm: st_stm32: Using LL library to implement gpio functions
The original implementation of gpio functions access registers
directly. Using LL library can add a set of unifying access
functions for all series of stm32 for avoiding accessing low level
code, and improve readability.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
2019-01-10 13:09:19 -06:00
Song Qiang 9612f9d840 soc: arm: st_stm32: Cleanup gpio function code.
All series STM32 have mostly the same GPIO architecture
and can share the same code for GPIO manipulation.
Functions of the external interrupt line control are also the same.
This patch extracts common code from them and put them into the 'common'
folder.

Functions of control GPIO of these series scattered in
soc/arm/st_stm32/stm32xx/ folders contain these functions:
stm32_gpio_flags_to_conf(), stm32_gpio_configure(), stm32_gpio_set(),
stm32_gpio_get, stm32_gpio_enable_int().
This patch merges them into the gpio_stm32.c file.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
2019-01-10 13:09:19 -06:00
Wayne Ren f0db0b8815 driver: uart_ns16550.c: necessary changes for arc iot soc
1. optimize the baudrate calulation
2. For arc iot soc, the interval val is 4
3. before write any regs, the clk of uart must be enabled

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-01-10 07:05:51 -05:00
Jan Van Winkel a6b286ced4 flash: Remove shell context from flash shell
Remove external declared shell context from flash shell

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-01-09 16:33:15 -05:00
Jan Van Winkel ea3ca125bb flash: Use flash page layout size in flash shell
Use the page size retrieved via page layout in flash erase
shell command in case erase size is not given.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-01-09 16:33:15 -05:00
Sathish Kuttan b3bb689cab drivers: tlv320dac: use reset GPIO from DTS
Driver update to use GPIO driver for the reset control signal.
Driver update to use definitions from DTS including I2C address.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-01-09 12:52:52 -06:00
Sathish Kuttan 24ec8a44d2 drivers: tlv320dac: add GPIO as Kconfig dependency
Update Kconfig for tlv320dac audio DAC to include GPIO
as a dependency. The codec driver now uses GPIO driver
to control the RESET for the DAC.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2019-01-09 12:52:52 -06:00
Kumar Gala a4c3feced4 dts: flash: w25qxxdv: Add Device Tree Support for SPI FLASH w25qxxdv
Convert the w25qxxdv driver to use device tree for SPI device params.
Updated the Arduino 101 config to use device tree to specify the SPI
flash.  Update the arduino_101_sss to drop Kconfig support for the
w25qxxdv flash.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-09 10:26:10 -06:00
Piotr Mienkowski 8bed2d5e27 soc: silabs_exx32: Add SWO logger support
By default, after reset SWO signal is not connected to GPIO pin. This
commit adds required initialization code to enable support for SWO
logger. Not all SoC series support the feature.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-01-09 15:30:59 +01:00
Erwan Gouriou 11eacffdd4 drivers/serial: stm32: Remove superfluous dependency in Kconfig
In Kconfig.stm32, all UART port symbols were defined with a dependency
on symbol UART_STM32. This is redundant since they are located under
if UART_STM32 condition.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-01-09 08:05:24 -06:00
Erwan Gouriou 4a25ae1694 drivers/serial: stm32: rename symbol UART_LPUART_1 to LPUART_1
Following recent renaming of STM32 UART Kconfig UART symbols,
LPUART was named as UART_LPUART_1.
Rename to LPUART_1.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-01-09 08:05:24 -06:00
Erwan Gouriou f5d48240e9 drivers/gpio: stm32l4: PortG[15:2] requires dedicated VDDio2
On STM32L4, 14 pins (Port G[15:2]), require external power supply.
Activate this at port G init when PWR_CR2_IOSV is defined.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-01-09 08:05:24 -06:00
Piotr Mienkowski aa2c27d007 soc: silabs_exx32: Add independent Kconfig options for HAL libraries
Zephyr gecko drivers depend on libraries provided by the vendor. The
same libraries may also be used directly by the application code or
RAIL library. To facilitate the latter use case scenario this commit
adds Kconfig options to independently enable compilation of vendor
HAL library modules.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-01-08 13:31:42 -06:00
Piotr Mienkowski f17e7c5942 drivers: i2c: add missing I2C_GECKO Kconfig option
This commit adds missing I2C_GECKO Kconfig option which currently is
being set implicitly via .defconfig file.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-01-08 13:31:42 -06:00
Ashokkumar B 2b0507ce14 drivers: gpio: Add support for Stellaris gpio controller driver.
* Add support for gpio controller driver

Signed-off-by: Ashokkumar B <ashokkumar@zilogic.com>
Signed-off-by: Subash G <subash@zilogic.com>
Signed-off-by: Vishnu K <vishnu@zilogic.com>
Signed-off-by: Vaishnavi D <vaishnavi.d@zilogic.com>
2019-01-08 13:30:26 -06:00
Piotr Mienkowski 973af2c8d7 dts: silabs: use 'aliases' to remove dts_fixup defines
By adding 'aliases' node in SoC .dtsi file it is possible to generate
DT_ defines which specify a logical name rather than relay on module
location on APB bus. E.g. DT_SILABS_GECKO_USART_40010000_LABEL becomes
DT_SILABS_GECKO_USART_USART_0_LABEL. Thus it is possible to remove
dts_fixup.h defines.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-01-08 11:56:02 -06:00
Piotr Mienkowski 1bfc52b81b drivers: i2c: remove deprecated i2c_atmel_sam3 driver
The i2c_atmel_sam3 driver was deprecated at release 1.9, this commit
removes it. Also pinmux_dev_atmel_sam3x driver is removed.
i2c_atmel_sam3 was the last one which depended on it.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-01-08 09:23:17 -06:00
Armando Visconti f300dedcc1 drivers/sensor/lsm6dsl: Use DT defines to select I2C/SPI bus
Remove configuration parameter CONFIG_BUS_TYPE. Now we may
make use of DT_ST_LSM6DSL_BUS_I2C and DT_ST_LSM6DSL_BUS_SPI
definition to select the bus.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-08 09:15:51 -06:00
Loic Poulain c9a9e0a4ee drivers: wifi: eswifi: Fix coverity issues
This patch fixes the following issues:
CID 190622 (#1 of 1): Out-of-bounds access (OVERRUN)
CID 190632 (#1 of 1): Out-of-bounds access (OVERRUN)
CID 190623 (#1 of 1): Unchecked return value (CHECKED_RETURN)
CID 190628 (#1 of 1): Out-of-bounds write (OVERRUN)
CID 190620 (#1 of 1): Dereference after null check (FORWARD_NULL)

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-08 08:01:20 -05:00
Tomasz Bursztyka 88b2535e0d drivers/ieee802154: Fix UPIPE driver at boot
Before it is initialized, upipe_dev is not set. Fixes this issue:

SeaBIOS (version rel-1.11.2-0-gf9626ccb91-prebuilt.qemu-project.org)
Booting from ROM..***** CPU Page Fault (error code 0x00000000)
Supervisor thread read address 0x00000008
PDE: 0x025 Present, Read-only, User, Execute Enabled
PTE: 0x00 Non-present, Read-only, Supervisor, Execute Enabled
Current thread ID = 0x00401a40
eax: 0x00000000, ebx: 0x0040c668, ecx: 0x00000001, edx: 0x000002f8
esi: 0x0040ac5b, edi: 0x0040ac38, ebp: 0x0040b4a8, esp: 0x0040b498
eflags: 0x00000202 cs: 0x0008
call trace:
eip: 0x00008651
     0x000082a3 (0x400a8d)
     0x00008b12 (0x40c668)
     0x00008632

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-01-08 11:25:33 +02:00
Olivier Martin 7031d5bdda drivers: flash: w25qxxdv: write across programming pages
Until now spi_flash_wb_write/read functions were only supporting
buffers that fit into a W25Q page (even if there were not checking
the offset was page aligned).
This change allows these function to read/write multiple W25Q page.
This change is required as the caller of these functions are not
aware of flash page size.

Signed-off-by: Johannes Hutter <johannes@proglove.de>
Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
Signed-off-by: Michael Wendland <michael@proglove.de>
2019-01-07 16:09:04 -05:00
Olivier Martin 4bc4bbf350 drivers: flash: w25q: Allow to skip SYNC_LOCK/SYNC_UNLOCK
The next commit will use this new
spi_flash_wb_write_protection_set_with_lock() in
spi_flash_wb_write() that already hold the lock.
To prevent a lock we need to skip the SYNC_LOCK when we want
to disable write protection.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2019-01-07 16:09:04 -05:00
Jan Van Winkel 49ffca4553 display: Added double buffer screen info to display API
Extend display API screen info with double buffer enum entry.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-01-07 16:05:35 -05:00
Manivannan Sadhasivam 3807c9af05 drivers: pinmux: stm32_f4: Add missing pinmux definitions for PWM
Add missing pinmux definitions for STM32F4 PWM.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2019-01-07 14:30:12 -06:00
Vinayak Kariappa Chettimada 87fe440f01 Bluetooth: controller: Prepare to introduce LL split architecture
Preparation to introduce the Upper Link Layer (ULL) and
Lower Link Layer (LLL) split architecture.

- Move SoC dependent HAL to vendor specific folder.
- Preparation to split data structures into ULL and LLL
  types.
- Added more role and state conditional compilations.
- Added some work-in-progress implementation of advertising
  extensions, will be used as inspiration in the new split
  architecture work.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-01-07 13:42:01 +01:00
Jan Van Winkel 3a8c2b8ad8 flash: Remove NRF dependency from flash shell
Removed dependency to NRF_FICR CODEPAGESIZE from flash shell erase
command

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-01-07 11:10:34 +01:00
Maureen Helm 011a88c744 ext: mcux: Update to MCUXpresso SDK 2.5.0
Updates the MCUXpresso SDK to version 2.5.0 for applicable SoCs.
Wireless (KW*) and legacy (KL25) SoCs were not included in this
MCUXpresso SDK release and are therefore not updated here.

New in this release is SoC-level and board-level support for external
xip flash in the i.MX RT family.

For RT1050, we are now using the MCUXpresso SDK for the EVKB version of
the board, which correponds to an upgrade from A0 to A1 silicon.
However, we don't yet have Kconfigs in place to support A1 silicon part
numbers, and therefore add a simple cmake hack to convert A0 part
numbers to A1 part numbers.

The SDK flash driver interface also changed slightly in this release,
and thus the zephyr flash shim driver is updated accordingly.

Origin: MCUXpresso SDK
License: BSD 3-Clause
URL: mcux.nxp.com
Purpose: Provide device header files and bare metal peripheral drivers
for Kinetis, LPC, and i.MX SoCs.
Maintained-by: External

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-01-03 17:25:28 -05:00
Loic Poulain a32a39f3d2 drivers: usb_dc_stm32: Add support for MSI clock
When MSI clock is available and in PLL-Mode (high accuracy), use it as
USB source clock. This allows to enable USB on STM34l475 disco iot
board without having to add external oscillator.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-02 09:33:21 -05:00
Loic Poulain 85b8a6b84b clock_control: stm32: Add support for MSI PLL MODE
Add support for Low Speed External 32.768 kHz oscillator (LSE ).
Add support for MSI PLL-Mode offering an automatic calibration feature
in combination with the LSE. This allows the MSI to reach an accurate
+/-0,25% clock perfectly suitable for USB full-speed clock.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-02 09:33:21 -05:00
Sebastian Bøe acb6486489 kconfig: Hide the Stellaris serial driver on unsupported platforms
Hide the Stellaris serial driver on unsupported platforms.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe 92ccd2ccd8 kconfig: Refactor the dependency on 'NET_L2_ETHERNET'
Refactor the dependency on 'NET_L2_ETHERNET'.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe 2b89316a52 kconfig: Fixed missing dependency for ETH_SAM_GMAC
The Kconfig option ETH_SAM_GMAC was missing it's dependency on
NET_L2_ETHERNET. Before this patch Kconfig was allowing users to
enable the driver, but the driver was not added because the CMake code
only adds the driver when NET_L2_ETHERNET.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe 204f05b23a kconfig: Minor comments and 'help' text fixes
Minor comments and 'help' text fixes.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Jan Van Winkel 848b0844dd driver: display: Added dummy display driver
Added dummy display driver.

fixes: #12001

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-30 15:53:39 -05:00
Anas Nashif 74a74bb6b8 power: rename api sys_soc -> sys_
sys_soc is just redundant, just call APIs with sys_*.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-28 16:16:28 -05:00
Anas Nashif 9151fbebf2 power: rename APIs and removing leading _
Remove leading underscore from PM APIs. _ was used for internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-28 16:16:28 -05:00
Vincent Wan 0f64ec5c31 drivers: wifi: simplelink: Fix strings used in assertions
Samples for cc3220sf_launchxl where assertions are enabled
(e.g. http_get) fail to build because some of the strings used in the
simplelink wifi driver have parentheses around them. This breaks the
current implementation of the __ASSERT macro. This commit removes
the parentheses, which are unnecessary.

http_get has been verified to build after this change.

Fixes #12192

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2018-12-26 09:42:29 -05:00
Jan Van Winkel 1f1ea26cdc driver: display: sdl: Return correct pixel format
Return actual pixel format that is in use by the SDL display driver
instead of returning a hard coded value.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-26 09:42:05 -05:00
Andrzej Głąbek 46b7633878 drivers: spi: nrfx: Set default value of SPIM3 RX delay to 2
To make it consistent with the default value set in hardware
after reset.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Andrzej Głąbek 4b43065cfc drivers: nrf: Enable nRF drivers by default in Kconfig
Make the following nRF peripheral drivers:
- ADC
- GPIO
- I2C
- SPI
- UART
- USB_DEVICE
enabled by default so that users do not need to explicitly enable them
in their applications after choosing an nRF SoC as the build target.

Kconfig options enabling these drivers depend on both a given hardware
feature (e.g. I2C) and an nRF family SoC selected, so effectively they
will be automatically enabled only when it is adequate (and in most
cases these drivers are the only option for a given hardware feature
on nRF SoCs).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Andrzej Głąbek 7c13ba9965 drivers: serial: nrf: Remove false dependency on the gpio driver
Implementations of both flavors of serial drivers for Nordic SoCs
are no longer dependent on the gpio driver. Remove the dependency
from Kconfig.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Armando Visconti b75a05cae6 driver: sensors: convert lsm9ds0_gyro to use information coming from dts
Convert lsm9ds0_gyro driver to get the device name as well as
i2c slave information and gpio info for triggers from device tree.
Updates the build_all test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-20 12:35:46 +01:00
Andrzej Puzdrowski 3f422e2efe drivers: flash: fix the regular access range check
The check was susceptible for overflow.
This patch corrects this malfunction.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-19 17:47:08 +01:00
Andrzej Puzdrowski cd4fbdeac8 drivers: flash: support NRF UICR operations
Nordic UICR are non-volatile memory registers for
configuring user-specific settings. Basically it is subset of flash
memory available in the SoC.

Add support for operations on NVM which belongs to UICR.
UICR are written or read as ordinary flash memory.
For erasing UICR it is required to call erase with UICR start
address and its size (this is caused by what hardware supported).

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-19 17:47:08 +01:00
Dhananjay Gundapu Jayakrishnan bfe0c2e748 drivers: sensor: temp_nrf5: update assert condition in nRF temp sensor
nRF 16MHz clock is used by both BLE radio and temperature sensor.
During BLE connection if the temperature sensor is also used then
at some point assert condition is hit in temp_nrf5_sample_fetch().
The error code -EBUSY seen during clock_control_off() is that clock
is no longer needed for the temperature sensor, but it cannot be
just turned off because it is still needed for BLE connection.

Signed-off-by: Dhananjay Gundapu Jayakrishnan <dhananjay.jayakrishnan@proglove.de>
2018-12-19 09:03:47 -06:00
Robert Lubos 82d956fdf8 drivers: ieee802154: nrf5: Prevent driver from spamming logs
ieee802154_nrf5 uses net_analyze_stack function in a loop, which
prints logs at inf level. As net_core's log level is used in
this function which by default is set to inf, it kept spamming stack
usage logs.

Prevent this behavior by adding additional log level check in the driver
itself, so that this log will only be printed if
IEEE802154_DRIVER_LOG_LEVEL is set to debug.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-12-19 08:20:55 -06:00
Armando Visconti 4446b16e24 driver: sensors: convert lsm9ds0_mfd to use information coming from dts
Convert lsm9ds0_mfd accel/magn driver to get the device name as well
as i2c slave information from device tree. Updates the build_all
test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-19 07:31:18 -06:00
Armando Visconti 6e2a1b62c4 drivers: lsm9ds0_mfd: Fix typo in get accel/magn channels
Fixed channel type in get accel/magn channel routines,
where, by mistake, GYRO definitions were used instead of
ACCEL/MAGN ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-19 07:31:18 -06:00
Aurelien Jarno c52a64624e drivers: usb_dc_stm32: add support for SoF event
Add support for SoF events to the USB STM32 device driver. When
CONFIG_USB_DEVICE_SOF is enabled, enable the corresponding interrupt
and provide a non-weak callback function calling status_cb.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:17:58 -06:00
Pushpal Sidhu f603e2509d drivers: i2c_ll_stm32_v2: Handle errors during data transfers
Check for ARLO, BERR, OVR, and NACK errors during any kind of
transmission. Helps fix getting into a while(1) loop in any of these
scenarios when in polling mode.

Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
2018-12-17 08:17:24 -06:00
Aurelien Jarno 6752b5df3f drivers: flash: add driver for STM32F7x series
This patch adds a flash driver for the STM32F7x series, inspired from
the STM32F4x one. It has been tested on the STM32F723, but should also
work on other SoCs of the family.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Aurelien Jarno 48d1fbb352 drivers: flash: stm32: pass offset and len to flash_stm32_flush_caches
On SoC families using a Cortex-M7, it is possible to flush only specific
cache lines. Therefore pass the offset and len so that the flush can be
done with more granularity.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Aurelien Jarno 123b832a02 drivers: flash: stm32: don't flush i-cache after an erase
In general synchronisation between memory and the instruction cache
should be done explicitly, for example this is how it is done for RAM.
It is also done that way for flash writes in the current STM32 flash
driver.

However in case of flash erases, the current STM32 flash driver flushes
the i-cache. It probably doesn't make a big difference for the
Cortex-M3/M4 families as the cache is very small. That said it might
have bigger impact on families based on Cortex-M7 as it has between 4KB
and 16KB of i-cache, that will be added latter in this patch serie.

This patch therefore remove the i-cache flush in
flash_stm32_flush_caches.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Aurelien Jarno 551f9c38b8 drivers: flash: stm32: always define flash_stm32_flush_caches
This reduces the amount of #ifdef and keep all of them at the same
place. The empty function is then optimized-out by the compiler.

At the same time change the negative test by a positive one to simplify
adding new entries.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Aurelien Jarno 8e356dbc88 drivers: flash: stm32: improve timeout handling
The timeout handling in the STM32 flash driver is currently a counter
in the busy check loop. This doesn't scale well across the whole STM32
family:
- The duration of the loop depends on the CPU speed, the activation of
  caches.
- The duration of the longest flash operation (a sector erase as the
  driver doesn't support mass erase) can varies a lot mostly depending
  on the sector size, 2K on F0 and L4 families or 128K on the F4 family.

In addition the timeout can change depending if the writing thread is
prempted or not.

Fix that by defining a timeout in ms depending on the family, and using
k_uptime_get to get a precise measurement of the time.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Nicolai Glud 763af40159 drivers: adc: adc_mcux_adc16: improving configurability
This change enables configuration of bit resolution of the adc mcux
adc16.

Signed-off-by: Nicolai Glud <nigd@prevas.dk>
2018-12-14 12:40:51 -06:00
Jukka Rissanen 9019207964 drivers: eth: gmac: Remove extra variable
The msg_start variable was declared twice.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-14 18:34:16 +02:00
Erwan Gouriou b1008ccb02 drivers/serial: stm32: Modify Kconfig instance flags
STM32 uart Kconfig instance flags were not following
same naming scheme than other drivers (i2c, spi, ..)

Update driver to use UART_X instead of UART_STM32_PORT_X

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-14 09:59:37 -06:00
Tomasz Bursztyka 7f8d92827f net/ethernet: Remove usage of net_pkt_ll() function
This function is planned to be removed, thus avoiding its usage.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka e97a543e9b net/pkt: Remove parameters to "reserve" some headroom
Such parameter is not used anymore, it was defaulted to 0 previously.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka 0f9312cde9 drivers/wifi: Remove usage of ll_reserve
It's not used anymore by the core IP.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka 6ea225e34a net/ieee802154: Finally removing usage of ll_reserve in L2
Moving towards serialized fragmentation, adapting mac command creation
to avoid the need of ll_reserve etc...

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Tomasz Bursztyka bff65b6330 net/ethernet: Let's remove the use for ll reserve
There is no need to reserve any space for each frag, as the l2 will
allocate a frag for the ethernet header, arp will do the same.

This is one step further to removing the concept of ll reserve.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-14 14:16:37 +01:00
Olivier Martin 0fc8a357a1 drivers: i2c: nrfx: Prevent transfer overlapping
I2C transfers could simultaneous be called that would
cause an inconsistent state in NRFX I2C state (and HW).
The NRFX TWI driver would expect to be in state
`NRFX_DRV_STATE_INITIALIZED` while being in state
`NRFX_DRV_STATE_POWERED_ON`.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-12-14 08:46:35 +01:00
Johann Fischer 0187d60937 drivers: adc_mcux: improve initialization of the ADC
Improve initialization of the ADC.

After initialization with the default values, the clock source
of the ADC is asynchronous clock (ADACK) and clock divide ratio
is 8. The minimum conversion clock frequency is 1MHz.
Add clock divider selection and set default divide ratio to 1.
That sets the conversion clock frequency to approximately 5MHz.

Default configuration for the voltage reference is set to
external pins V_REFH and V_REFL. Depending on the MCU configuration
V_REFL may be connected to ground and V_REFH to VREF_OUT.
Since Voltage Reference block is not supported, the ADC does not work
properly on FRDM-KW41Z. Add voltage reference selection to fix it.

Enable self-calibration function as recommeded in Reference Manual.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-12-13 08:32:18 -06:00
Johann Fischer 487603e655 drivers: adc_mcux: save pointer for repeated sampling
Save pointer for repeated sampling.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-12-13 08:32:18 -06:00
Manivannan Sadhasivam a6e1c0dc8e pinmux: stm32: Add missing pinmux for I2C2 and SPI2
Add missing pinmux configuration for STM32 I2C2 and SPI2.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-12-13 08:07:28 -06:00
Manivannan Sadhasivam f8ac865693 arm: stm32f4: Add UART4 pinmux definitions
Add missing UART4 pinmux definitions for STM32F4 series.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-12-13 08:07:28 -06:00
Andrzej Głąbek 7d159a5e6c drivers: gpio_nrfx: Remove undesired NRF_P0 definition
This definition was needed to translate the old symbol used in MDK
for accessing the GPIO peripheral in nRF51 SoCs (NRF_GPIO) to the
one used for all newer SoCs (NRF_P0). Now the translation is done
in the HAL for GPIO (nrf_gpio.h).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-13 07:35:28 -06:00
Manivannan Sadhasivam b8c83338ec dma: stm32: Configure bus width and burst size for memcpy mode
In order to make use of the configurable bus width and burst size
options in memcpy mode, lets add configurations bits for the same.

This configuration is derived from the TRM of STM32F446xx Page No. 210
"Memory-to-memory mode" section and verified on 96Boards STM32 Sensor
Mezzanine board.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-12-13 07:33:30 -06:00
AJ Palmer f24834525f stm32: drivers: spi: Added missing devices
Added missing DEVICE_AND_API_INIT definitions: SPI_4, SPI_5 and SPI_6.

Signed-off-by: AJ Palmer <ajpcode@hotmail.com>
2018-12-13 07:31:06 -06:00
David Vincze 936d8bd378 drivers: timer: fix disable systick function
This patch fixes a bug in System timer driver where
the sys_clock_disable() function was enabling the
timer instead of disabling it.

Change-Id: I4a667d30d43d1f84094d074241ee18d7bb2b2565
Signed-off-by: David Vincze <david.vincze@arm.com>
2018-12-12 15:40:36 -06:00
Kumar Gala 0fbcf03ba9 drivers: wifi: eswifi: Remove unused code
uarthost isn't used anywhere, so lets remove it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-11 09:57:13 -06:00
Kumar Gala 0c12a7b050 drivers: wifi: eswifi: Fix build issue due to -fno-common
The introduction of -fno-common caused a link error in eswifi driver due
to lack of missing extern on eswifi_bus_ops_spi.  Adding the extern
resolves the link error.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-11 09:57:13 -06:00
Gaute Gamnes 2d5ea10f31 drivers: pwm: nrf: Removed Kconfig prescaler option. Rewrite HW driver
1. Kconfig options clock_prescaler removed.
2. Rewritten pwm_nrfx.c nRF HW PWM driver.

Signed-off-by: Gaute Gamnes <gaute.gamnes@nordicsemi.no>
2018-12-11 15:18:14 +01:00
Gaute Gamnes d6e66d0453 drivers: pwm: nrf: Migrate Kconfig options to DT
1. Kconfig options CH pin removed.
2. Kconfig options CH inverted removed.
3. Modified pwm_nrfx.c driver to use DT
   defines instead of Kconfig.

Signed-off-by: Gaute Gamnes <gaute.gamnes@nordicsemi.no>
2018-12-11 15:18:14 +01:00
Armando Visconti ec47b7cd7d sensors: convert lis2mdl to use information coming from dts
Convert lis2mdl magnetometer driver to get the device name as well
as i2c slave information from device tree. Updates the build_all
test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-11 08:11:11 -06:00
Jukka Rissanen 3e8b2a0a37 drivers: eth: native_posix: Fix gPTP header parsing
We were reading gPTP header from wrong position when parsing
it in RX and TX.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-11 13:50:54 +02:00
Jukka Rissanen 32f02138dc drivers: eth: sam-e70: Fix gPTP header parsing
We were reading gPTP header from wrong position when parsing
it in RX and TX.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-11 13:50:54 +02:00
Jukka Rissanen 7503228ad0 drivers: eth: mcux: Fix gPTP header parsing
We were reading gPTP header from wrong position when parsing
it in RX and TX.

Fixes #11827

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-11 13:50:54 +02:00
Anas Nashif 1b48a7a715 drivers: flash_mcux: remove inclusion of sys+log.h
Stray inclusion of old sys_log.h. Nothing uses it in that driver.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-10 20:38:09 -05:00
Jan Van Winkel 6cb629c35b driver: SDL based display emulation driver
This driver introduces an emulated LCD display for the native POSIX
board. The emulated display driver makes use of SDL2 to render the
displays frame buffer into a dedicated desktop window.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-10 20:37:29 -05:00
Jan Van Winkel cbbea99eb5 drivers: display: Added windowing for SSD1673
Added support to the SSD1673 dipslay for partially writing the display

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-10 17:21:37 -05:00
Jan Van Winkel 6f42904185 drivers: Clear SSD1673 display during display init
Clear SSD1673 display during display driver initialization instead of
triggering clear via setting contrast.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-10 17:21:37 -05:00
Jan Van Winkel 79b58aa3fa drivers: Return correct erorr codes in SSD1673 driver
Return correct error codes in SSD1673 driver instead of -1

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-10 17:21:37 -05:00
Jan Van Winkel 8457891cea drivers: Added missing API functions in ssd drivers
Added missing API function set_orientation to ssd1306 & ssd1673
drivers.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-10 17:21:37 -05:00
Jan Van Winkel 9607dd9a16 drivers: Allow to set supported pix format in ssd drivers
Allow to set supported pixel format in ssd1306 & ssd1673 drivers

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-10 17:21:37 -05:00
Roman Vaughan ebf5dfb058 drivers: led_strip: Fix typo in APA102 driver
This typo was causing a compile error when ever the APA102
led_strip driver was enabled.

Signed-off-by: Roman Vaughan <nzsmartie@gmail.com>
2018-12-10 12:16:13 -08:00
Johann Fischer 7734627215 drivers: ieee802154_mcr20a: fix style
Fix style before DT_IEEE802154_MCR20A* macros.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-12-10 10:41:22 -06:00
Johann Fischer db64943aa5 drivers: ieee802154_mcr20a: do not initialize reset gpio on KW2XD
Do not initialize reset gpio on KW2XD SIP.
Modem's clock output is used by the SoC for the PLL.
Initialization of the reset gpio may result in the reset of the modem
and the crash of SoC.

Keep reset gpio low until modem initialization.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-12-10 10:41:22 -06:00
Johann Fischer f3a36502a0 drivers: ieee802154_mcr20a: fix update of indirect registers
Fix overwrites update of indirect register.
Since the indirect register should be updated,
the parameter dreg should be false.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-12-10 10:41:22 -06:00
Andrew Boie a68120de6d kernel: check retval of driver init
If initialization fails, zero the API struct so that
device_get_binding() can't fetch it, and do not mark
the driver object as initialized to user mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-12-07 19:33:23 -05:00
Wayne Ren f8022b2630 driver: arcv2_timer0: optimze the code
use a local variable to replace the ctrl_cache

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-12-07 17:08:15 -05:00
Wayne Ren 37b4d2cd06 drivers: arcv2_timer0: bug fixes
* remove QEMU related definitions
* fix the definition of TIMER 0 IRQ

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-12-07 17:08:15 -05:00
Wayne Ren f477f564c1 driver: arcv2_timer0.c: minor changes according to review
* code style and comment clean up

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-12-07 17:08:15 -05:00
Wayne Ren fceaf894c4 driver: refactor the arcv2 timer0 driver
refactor the arcv2 timer0 driver according to
the latest changes in sys clock dirver.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-12-07 17:08:15 -05:00
Mieszko Mierunski d1b3efd98b drivers: nrf: Fix TWI and TWIM current consumption issue
TWI and TWIM  peripheral is now enabled only during transfers.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-12-07 12:54:25 -05:00
Andrei Emeltchenko d8285e4adf pci: General code cleanup
Cleanup code

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Andrei Emeltchenko d0d426e898 pci: Remove inlines
Remove inline functions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Andrei Emeltchenko 6d8673c3ac pci: Use logger
Use logger for logging.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Andrei Emeltchenko 7dab29860a pci: Do not scan all functions for single function device
Check MF flag and behave accordingly.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Andrei Emeltchenko e5349d74ab pci: Fix endless loop scanning PCI devices on up_squared
Increase function number so that next scanning starts from the next
function.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Andrei Emeltchenko 4658d6b48c pci: Scan all PCI buses
Allow to scan all buses.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Andrei Emeltchenko 331a4ca853 pci: Skip scanning Host Bridge
Continue with scanning other devices.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Andrei Emeltchenko 80e5314bea pci: Enable pci shell only when shell is enabled
Fixes build with enabled PCI_SHELL and not enabled SHELL.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Andrei Emeltchenko 9a92ae4169 pci: Fix presentation of PCI devices
Follow Linux style for list PCI devices.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-12-07 11:32:45 -05:00
Erwan Gouriou 9062e97a45 drivers: stm32: check clock_control_on return value
Check clock_control_on return value now that it is checking appropriate
bus is used in the request.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-07 11:31:48 -05:00
Erwan Gouriou e24fcc55ce drivers/clock_control: stm32: add errors on unsupported bus value
Driver was not complaining when unsupported bus values where used.
Add default to switch cases and return error.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-07 11:31:48 -05:00
Erwan Gouriou d1fd304273 drivers/pinmux: stm32: GPIO ports missing in array
GPIO ports I, J, and K were missing in port_enable array.
Fix this to make them usable.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-07 11:31:22 -05:00
Erwan Gouriou ea1f2b60a0 drivers/gpio: stm32: return error when pin line already in use
GPIO pin interrupts share common EXTI resources.
Return an error when attempt to configure a line already in use.

Fixes #10611

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-07 11:31:22 -05:00
Armando Visconti e721b498ce drivers/lis3dh: Add symbol to TRIGGER_MODE config choice
Add symbolic names to trigger mode (LIS3DH_TRIGGER_MODE) in order to
be defined in board defconfig files.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-07 10:43:13 -05:00
Armando Visconti 7dbbb07f07 sensors: convert lis3dh to use information coming from dts
Convert lis3dh accelerometer driver to get the device name as well
as i2c slave information from device tree. Updates the build_all
test accordingly.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-07 10:43:13 -05:00
Ramakrishna Pallala a4f933677b drivers: flash: Nios-II QSPI Coccinelle issue
Fixed Coccinelle warning "Unsigned expression compared with zero".

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-12-07 10:42:01 -05:00
Adithya Baglody 567de65f84 drivers: ipm: ipm_quark_se: Remove object declaration from header
The header ipm_quark_se.h was creating a object. Hence removed it
and placed the same in ipm_quark_se.c

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Jukka Rissanen ff0483c5af net: gptp: Get the gPTP header properly
If the link layer header is in the separate net_buf,
then skip that one.

Fixes #11827

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 16:43:59 +02:00
Tomasz Bursztyka 8a8d4d3070 drivers/ethernet: Update RX error statistics relevantly
Update such statistic on all drivers.
Also, remove TX stats in native and stellaris drivers: such update is
done in L2 now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-07 14:30:06 +02:00
Tomasz Bursztyka 538961d109 drivers/ethernet: Remove double unref from stellaris driver
It's now either L2 which unref the pkt on successful tx, or net_if on
error.

Also removing pkt->frags check, net_core.c:net_send_data() does it
already.

And using data_len in logging instead of net_pkt_get_len(), which one is
currently greedy (it goes over all net_bufs).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-07 14:30:06 +02:00
Armando Visconti 802ad61aba drivers: sensors: lis2dh: Fix out-of-bound access
FIX issue #10571 and #10593
atomic_xxx() functions expect the bit argument to be the
position index inside the target integer and not its
numerical representation (e. g. 5 means the 5th bit and not 32).
The original code could potentially override an adiacent variable.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-12-05 10:38:38 -08:00
Kumar Gala 1fe9a5b8d8 dts: ieee802154: cc1200: Add DTS support
Add a dts binding file for the cc1200 and move the Kconfig options for
SPI and GPIOs to DTS for the CC1200 driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-05 10:13:23 -06:00
Jakub Rzeszutko 3064ca4f2f shell: creating new module for help functionality
1. Created new shell module: shell_help.
2. Simplified command handlers with new shell print macros.
3. Removed help functions from command handlers.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko e0be6a10b3 shell: printing command's help by shell engine
Removed printing command help from help handler. It is now
realized by the shell engine. This change saves a lot of flash
but still allows to print help in command handler with function
shell_help_print.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko 5451ff2848 shell: remove "options" concept
Removing help "options" from shell API.

Currently SHELL_OPT macro is not used by users. What is more
commit: a89690d10f ignores possible options created in
command handler by the user. As a result they are not printed
in help message.

Second, currntly implemented "options" in command handlers options are
implemented without SHELL_OPT macro.

And last but not least this change will allow to implement
help handler in a way that user will not need to think about calling
functions printing help in a command handler.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Loic Poulain c67bb6d440 wifi: eswifi: Fix/clean TCP receive
This patch adds support for blocking tcp receive (with timeout).
This patch removes dedicated socket polling thread to use common
eswifi workqueue instead.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-12-05 08:56:24 -05:00
Loic Poulain 791343bb18 wifi: eswifi: Add support for non-blocking TCP connect/send
Current implementation unconditionnaly performs blocking connect
and send. Add support for non-blocking version using eswifi workqueue.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-12-05 08:56:24 -05:00
Aurelien Jarno 0ac7338258 drivers: console: fix USB_UART_CONSOLE
The USB_UART_CONSOLE option itself is not enough to enable console on
the USB UART port. Most of the code is actually shared with
UART_CONSOLE, so this symbol has to be selected.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-05 08:53:15 -05:00
Pawel Dunaj e344e5752c ext: debug: segger: Fix SEGGER header inclusion
Fix issue caused by 3fc497ac9a

This change removes `rtt` and `systemview` from header includes
as these are already placed in the path.

Also `SEGGER_SYSVIEW_ConfDefaults.h` header included from
`SEGGER_SYSVIEW_Int.h` is placed higher to make sure `INLINE`
definition is properly visible.

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2018-12-05 14:35:42 +01:00
Tomasz Bursztyka 1a59e0abf1 drivers/ethernet: Adapt stellaris driver to new L2 behaviour
L2 is the one who requests the packet to be sent, and not via net_if API
anymore. Stellaris driver was merged right after this behaviour change
and was thus lacking the proper modification.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-05 15:04:56 +02:00
Peter A. Bigot 3134468801 drivers: gpio: nrfx: fix lost level interrupts
Nordic devices detect edge interrupts through the PORT event which is
generated on a rising edge of DETECT, which itself is asserted when any
GPIO is configured for sense level detection and the GPIO's input signal
matches the configuration.

The previous code in Zephyr attempts to detect when at least one GPIO
SENSE signal is still asserted, and intentionally leaves the PORT event
uncleared to ensure the interrupt is re-entered.

This approach fails when no pin satisfies its SENSE condition during the
check but at least one input changes level between the completion of the
check and the clear of the PORT event.  Such a failure can be observed
on the pca20020 hardware when multiple sensors configured for level
triggers are active.  In this situation the corresponding sensor trigger
signals remain asserted but the PORT event required to drive their
processing has already been cleared.

The fix is to ensure that the SENSE configuration for all GPIOs across
all port instances is disabled prior to unconditionally clearing the
PORT event, then re-enabling the SENSE configuration for all GPIOs once
callbacks associated with detected SENSE triggers have been performed.
The act of re-enabling will ensure any relevant SENSE condition causes a
new rising edge on DETECT and so a new PORT event.

Closes issue #11806

See: https://devzone.nordicsemi.com/f/nordic-q-a/7246/missing-interrupts-on-gpioe-port-events

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-12-05 12:15:11 +01:00
Patrik Flykt 8ff96b5a57 drivers: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Vijay Kumar B cffb2d8051 drivers: ethernet: Add TI Stellaris ethernet controller driver.
The driver can be tested using different networking emulation
approaches.

This approach will work across multiple Qemu instances. There can be
more than one Qemu instance, run using the following command. They
would appear to be on the same Ethernet network.

  $ qemu-system-arm -M lm3s6965evb                      \
                    -serial stdio                       \
                    -net nic                            \
                    -net socket,mcast=230.0.0.1:1234    \
                    -kernel zephyr.elf

This approach will work with other virtualization technologies that
support connecting to a VDE switch, like VirtualBox and User Mode
Linux. The switch can be started using the following command.

  $ vde_switch --sock /tmp/switch

Qemu can be connected to the switch using the following command.

  $ qemu-system-arm -M lm3s6965evb                      \
                    -serial stdio                       \
                    -net nic                            \
                    -net vde,sock=/tmp/switch   	\
                    -kernel zephyr.elf

Signed-off-by: Fadhel Habeeb <fadhel@zilogic.com>
Signed-off-by: Nirav Parmar <niravparmar@zilogic.com>
Signed-off-by: Vijay Kumar B <vijaykumar@zilogic.com>
2018-12-04 09:36:51 -06:00
Erwan Gouriou 3c009a7f2f drivers/pwm: stm32: Use device tree for clocks and base address config
Use device tree generated #define's to configure STM PWM devices

Fixes #10449

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-04 09:07:28 -06:00
Krzysztof Chruscinski d8e3ea6bc2 drivers: clock_control: Enable LFSTARTED event for nrf5
The LFSTARTED event was disabled so it was impossible to wake the
CPU up on LF clock being ready. The Bluetooth stack was putting
the CPU to sleep, expecting to be woken up on LFSTARTED event.
As the event never triggered, the CPU was woken up seconds later
by a different event introducing a multi-second startup delay.

Bug introduced by 23c92100ac.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-12-04 16:43:49 +02:00
Nathaniel Graff 6243a578ab drivers/plic: Update PLIC driver with DTS symbols
Use the DTS-generated symbols for accessing MMIO registers in the PLIC.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2018-12-04 07:48:27 -06:00
Paweł Zadrożniak 6e460ca64f drivers: usb: nordic: Fix class/vendor request handling
SetAddress request (0x05) is ignored and not propagated, because it
is handled by nRF hardware. Curently, request type is not checked
causing class or vendor request 0x05 to be inappropiately ignored.
Only standard requests (type = 0) shoud be ignored. This commit
fixes the issue.

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2018-12-04 13:53:48 +01:00
Jukka Rissanen 3ac7c12b4f drivers: eth: native_posix: Enable PTP clock support for gPTP
If gPTP is enabled, then enable also PTP clock driver so that
gPTP sync starts to work properly for native_posix board.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-04 01:15:38 -05:00
Jukka Rissanen e694b1a5f9 drivers: eth: native_posix: Fix PTP driver init priority
The PTP driver was init too late which prevented gPTP from
working in native_posix board.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-04 01:15:38 -05:00
Diego Sueiro f1caf676ca drivers/serial: Fix uart issues for i.MX7 and i.MX6
This patch fixes the uart isr calling the callback with wrong data
(#11465) and the uart_poll_in checking the wrong status flag.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-12-03 15:15:36 -05:00
Andrzej Głąbek 965128bab1 drivers: usb_dc_nrfx: Align with nrfx version 1.4.0
A typo in the name of the bmRequest field in the nrfx_usbd_setup_t
structure was fixed in nrfx version 1.4.0. Update the driver to use
the new correct name: bRequest.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-03 17:56:15 +01:00
Jukka Rissanen d641ac6eee drivers: eth: native_posix: Fix gPTP compile error
If compiling with gPTP support for native_posix board, then avoid
compile error that is seen with gptp sample application.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-03 14:24:36 +02:00
Paweł Zadrożniak 1da367b5bf drivers: nordic: usbd: Fix long (fragmented) control OUT transfers
Fragmented long CTRL OUT transfers does not work properly, because
they were not handler properly by the shim. In such transfers,
a special call (nrfx_usbd_setup_data_clear()) must be performed
before every data packet and not just before the first one.
This patch adds a byte counter which is set while processing setup
packet (host->device only) to be able to decide whether there will
be more data packets coming (and to call_data_clear() or not).

Fixes #11232 .

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2018-12-03 10:28:11 +01:00
Aurelien Jarno 6ed2ea66d0 drivers: usb_dc_sam: add support for SoF event
Add support for SoF events to the USB SAM device driver. When
CONFIG_USB_DEVICE_SOF is enabled, enable the corresponding interrupt
and call the callback function from there.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-02 10:39:39 -05:00
Rajavardhan Gundi 7765c1adaf drivers: flash: spi_nor: Remove unused block_size parameter
Only page and sector size is used by the driver.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-02 09:27:16 -05:00
Rajavardhan Gundi 826a7cdca8 drivers: flash: spi_nor: Remove page alignment requirement for R/W
For flash R/W, the start address need not be aligned on a page size.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-02 09:27:16 -05:00
Jan Van Winkel 55f091f43f i2c: sensor: Replace static_assert by BUILD_ASSERT_MSG
Replace static_assert in NRFX TWI, TWIM and QDEC drivers by
BUILD_ASSERT_MSG

fixes: #11754

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-01 18:37:16 +01:00
Michael Scott d39d5881c3 drivers: i2c: fix build break for nrfx_twi* with newlib
When running sanitycheck for reel_board which selects
CONFIG_NRFX_TWIM it fails the following tests:
tests/misc/test_build/test_newlib
tests/kernel/errno/kernel.common.errno.newlib
tests/lib/mem_alloc/libraries.libc.newlib

/zephyr/drivers/i2c/i2c_nrfx_twim.c:144:3: error: expected declaration
specifiers or '...' before '(' token
   (bitrate == I2C_BITRATE_STANDARD ? NRF_TWIM_FREQ_100K         \
   ^
/zephyr/drivers/i2c/i2c_nrfx_twim.c:151:3: note: in expansion of macro
'I2C_NRFX_TWIM_FREQUENCY'
   I2C_NRFX_TWIM_FREQUENCY(           \
   ^~~~~~~~~~~~~~~~~~~~~~~
/zephyr/drivers/i2c/i2c_nrfx_twim.c:184:1: note: in expansion of macro
'I2C_NRFX_TWIM_DEVICE'
 I2C_NRFX_TWIM_DEVICE(0);
 ^~~~~~~~~~~~~~~~~~~~
/zephyr/drivers/i2c/i2c_nrfx_twim.c:154:3: error: expected declaration
specifiers or '...' before string constant
   "Wrong I2C " #idx " frequency setting in dts");         \
   ^
/zephyr/drivers/i2c/i2c_nrfx_twim.c:184:1: note: in expansion of macro
'I2C_NRFX_TWIM_DEVICE'
 I2C_NRFX_TWIM_DEVICE(0);
 ^~~~~~~~~~~~~~~~~~~~
zephyr/drivers/i2c/CMakeFiles/drivers__i2c.dir/build.make:62: recipe
for target
'zephyr/drivers/i2c/CMakeFiles/drivers__i2c.dir/i2c_nrfx_twim.c.obj'
failed

To fix this, let's replace the use of static_assert() with a more
generic macro: BUILD_ASSERT_MSG()  This should work across minimal
libc, newlibc and c++.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-12-01 18:35:21 +01:00
Tomasz Bursztyka ee9dedd5a7 net/iface: Finally remove the send function from net_if_api
And apply that to modem driver setting that pointer to NULL.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-30 11:12:13 -08:00
Tomasz Bursztyka ebb40ba338 net/ieee802154: Switch to L2 sending path
As for Ethernet, up to ieee802154 L2's send to actually sent the packet.
It's currently unoptimized as 6lo compression, 15.4 fragmentation and so
on will reallocate net_buf etc... but it's the first step towards
removing ll reserve space and more.

Applying changes to Openthread L2 as well.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-30 11:12:13 -08:00
Tomasz Bursztyka 7f2cb02720 net/dummy: Switch to L2 sending path
And adapt loopback and slip drivers relevantly

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-30 11:12:13 -08:00
Tomasz Bursztyka 9464ec3343 net/iface: Switch fully to a one-pass sending logic in net_if
Now instead of such path:

net_if_send_data -> L2's send -> net_if tx_queue -> net_if_tx -> driver
net_if's send

It will be:

net_if_send_data -> net_if tx_queue -> net_if_tx -> L2's send -> driver
net_if's send

Only Ethernet is adapted, but 15.4 and bt will follow up.
All Ethernet drivers are made compatible with that new scheme also.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-30 11:12:13 -08:00
Alexander Polleti 58b51dd0c5 pinmux: stm32f4: add MII interface
Add Pin multiplexing for MII ethernet interface for STM32F4.

Signed-off-by: Alexander Polleti <metapsycholo@gmail.com>
2018-11-30 10:59:49 -08:00
Alexander Polleti daf1ba6e52 ethernet: stm32: add MII mode
Add MII mode for STM32 Ethernet in Kconfig. Default is still RMII.

Signed-off-by: Alexander Polleti <metapsycholo@gmail.com>
2018-11-30 10:59:49 -08:00
Peter A. Bigot be624d8e51 drivers: sensor: sht3xd: change from level to double edge trigger
The sensor signal cannot be cleared by the application, so enabling
level triggers causes the system to hang as the callback is invoked
repeatedly.  We want notification when the alarm state is entered, and
when it's exited, so use a double edge.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 08:30:13 -08:00
Peter A. Bigot 5313d4fb51 drivers: sensor: sht3xd: migrate GPIO from Kconfig to device tree
Replace Kconfig ALERT signal GPIO device and pin information with device
tree bindings.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 08:30:13 -08:00
Peter A. Bigot b7dc23984d drivers: sensor: sht3xd: migrate I2C from Kconfig to device tree
Replace Kconfig I2C bus and address information with device tree
bindings.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 08:30:13 -08:00
Peter A. Bigot 2bb33a1bdc drivers: sensor: sht3xd: correct humidity threshold conversion
Original scale factor assumed a maximum humidity of 10^5 percent.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 08:30:13 -08:00
Alberto Escolar Piedras c34d919139 uart: native_posix driver: Fix typo
Just a typo fix.
Fixes #11179

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-30 08:00:34 -08:00
Armando Visconti a1c0a1fbe5 drivers/lis2dh: Add symbol to BUS_TYPE and TRIGGER_MODE config choices
Add symbolic names to bus type (LIS2DH_BUS_TYPE) and trigger mode
(LIS2DH_TRIGGER_MODE) in order to be defined in board defconfig
files.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-11-30 08:36:29 -06:00
Armando Visconti 73a6f58dd4 sensors: convert lis2dh to use information coming from dts
Convert lis2dh accelerometer driver to get the device name as well
as i2c/spi slave information from device tree. Updates the build_all
test accordingly. (issue #11605)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-11-30 08:36:29 -06:00
Peter A. Bigot d2f507855b drivers: timer: nrf_rtc_timer: fix handling for 24-bit counter
Two subtractions failed to account for the possibility that a calculated
time exceeded the counter resolution, allowing a comparison to
improperly indicate that a minimum delay was satisfied.

Use the subtraction helper to avoid the problem.

(The subtraction in z_clock_set_timeout was the cause of issue #11694;
the one in rtc1_nrf5_isr was replaced based on inspection rather than
testing.)

Closes #11694

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-11-30 15:05:25 +01:00
Sathish Kuttan 061944694a drivers: pinmux: add pinmux driver for Intel S1000
Added a pinmux driver for Intel S1000 SoC

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-29 14:23:24 -08:00
Flavio Ceolin 98d03266f1 serial: Change poll_out signature
poll_out function was returning the character that was sent. It
happens that it is always constant and the return of this functions is
never tested. Changing it to be a void function.

MISRA-C rule 17.7

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-29 10:18:59 -08:00
Mieszko Mierunski 94b72e7bea drivers: nrf: Add UART and UARTE configure function.
Add UART configure function for UART and UARTE shims.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-29 14:59:35 +01:00
Michael Scott 0abd92266a drivers: modem: wncm14a2a: correct comment in on_cmd_sockdataind()
The comment was incorrect explaining why we were sending an
AT-command without waiting for a response (via a K_NO_WAIT timeout).

Let's correct the comment and avoid confusion.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-28 15:34:19 -08:00
Michael Scott e8a690ff70 drivers: modem: wncm14a2a: remove socket_reading logic
Remove overly complicated logic to skip incoming data if we were
still waiting on a previous set of data to be read.

This fixes a bug where an error during data receive could end up
with the modem ignoring all incoming data.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-28 15:34:19 -08:00
Himanshu Jha f411073c85 drivers: sensor: vl53l0x: remove unnecessary variable
Remove an unnecessary local variable to store the
return value, instead return directly thereby saving
few bits of memory.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-28 11:54:01 -08:00
Himanshu Jha 3bff9b1b50 drivers: flash_gecko: remove unnecessary variable
Remove an unnecessary local variable to store the
return value, instead return directly thereby saving
few bits of memory.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-28 11:54:01 -08:00
Ashokkumar B 2652a81d98 drivers: spi: fix typo bug in spi_sam.c
* Change all occurance of sam0 to sam
     * Chande CONFIG_SPI to DT_SPI

Signed-off-by: Ashokkumar B <ashokkumar@zilogic.com>
2018-11-28 13:44:07 -06:00
Henrik Brix Andersen b52b79d15e drivers: spi: sam0: avoid unsigned comparision with less than zero
Avoid comparison of size_t with less than zero.

This fixes #11136.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-11-27 12:05:17 -08:00
Henrik Brix Andersen 4c533d053e drivers: spi: sam: avoid unsigned comparision with less than zero
Avoid comparison of size_t with less than zero.

This fixes #11136.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-11-27 12:05:17 -08:00
Rajavardhan Gundi 4b3f3ab056 drivers: flash: spi_nor: Correct the return values for R/W
Fixed the return values for read and write APIs for spin_nor.c
which were not inline with what the corresponding interfaces
were meant to return.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-11-24 07:58:05 -05:00
Mieszko Mierunski 9dc3870276 drivers: nrf: Support I2C initial speed configuration from dts
Current implementation had fixed initial speed, this commit
fixes TWI and TWIM shims to use configuration from DTS.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-23 12:39:36 -05:00
Aurelien Jarno 92f7c7c3b5 drivers: usb_dc_sam: kill a coverity warning
Coverity complains that packet_len can get assigned a negative value if
usb_dc_ep_mps() returns an error. This is correct, however it only
happens if the endpoint address is invalid, and in that case the value
is not used as the endpoint address is also validated in
usb_dc_ep_write().

Fix the issue by moving the assignment after the endpoint address
validation and by accessing the value directly instead of getting it
through usb_dc_ep_mps().

Fixes #11481
Coverity-CID: 189742

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-23 09:19:44 -05:00
Marcin Szymczyk e4c447aac3 usb: add SoF event
Start of Frame events can now be accessed from USB classes.
This will be useful when implementing idle rate functionality.

Signed-off-by: Marcin Szymczyk <Marcin.Szymczyk@nordicsemi.no>
2018-11-23 09:18:41 -05:00
Gil Pitney c51cf1e463 drivers: wifi: simplelink: Implement setsockopt() for TLS offload
Implements setsockopt() for the socket offload driver
to process the TLS tags sent in via the Zephyr setsockopt() API,
when CONFIG_NET_SOCKETS_SOCKOPT_TLS is chosen.
For each tag, the credential filenames are retrieved and
set via SimpleLink's sl_SetSockOpt() API.

Also, creates a new KConfig option for TLS_CREDENTIAL_FILENAMES.
This new option is used by apps/protocols to add TLS credentials
via filenames referring to the actual content stored on a secure
file system or flash.

Handles the IPPROTO_TLS_* socket protocol families in the
socket() offloaded API.

This was validated on the cc3220sf_launchxl with the http_get sockets
sample, with the globalsign_r2.der file loaded to secure flash via
the TI Uniflash tool, and using the TI Catalog of known good
root CA's.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-11-23 09:16:21 -05:00
Johann Fischer aee6764c32 drivers: ssd1673: fix SPI GPIO CS configuration
Use DT_SSD1673_SPI_GPIO_CS_DRV_NAME for CS configuration.

Resolves: #10720

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-11-23 08:39:20 -05:00
Aurelien Jarno 532550cba1 drivers/i2s_sam_ssc.c: enable cache support
Enable cache operations before starting a DMA operation if the CPU has a
cache. All the support was already in place, it just needs to be
enabled.

With the previous commits, it allows the I2S tests to pass on a SAM E70
Xplained board with the CPU cache enabled.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-22 13:16:42 -05:00
Paul Sokolovsky 45b1d73164 drivers: serial: uart_cmsdk_apb: Ack IRQs before callback to avoid races
This effectively reverts part of earlier 49bb163756 which moved
interrupt acknowledgement until after return from the user callback.
This was done confusing the flow of this driver with how some other
drivers do it, where pending interrupt status is checked by
uart_irq_rx_ready()/uart_irq_tx_ready(), which should be called by
the callback. But the uart_cmsdk_apb driver actually uses different
hardware register in these functions. And acking IRQs after user
callback can lead to race condition and losing an IRQ, and the
simple fix in this case is just move acknowledgement to where it
was before.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-11-22 13:14:19 -05:00
Paweł Zadrożniak 55674d8e17 drivers: usb: nordic: change USBD driver locking scheme
Nordic USB driver shim uses nrfx_usbd driver from nrfx package.
The driver was protected by a semaphore during every transfer
to prevent access from multiple threads at the same time.
This leads to the problem when a class schedules transfer on one
endpoint before host asks for the data (to be sent later) - driver
is locked and other endpoints (including control EP) are blocked.
Currently, only driver calls are wrapped with semaphore without
waiting for the transfer to complete, allowing scheduling transfers
on different endpoints. This is allowed bu nrfx_usbd, however
shim prevents user from scheduling multiple transfers on one
EP (required by nrfx_usbd).

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2018-11-22 13:13:16 -05:00
Mieszko Mierunski 1bfa721373 drivers: nrf: nrf uarte fix TX interrupts disabling.
Make sure that TX interrupts are disabled after transmission
is finished.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-22 14:06:01 +01:00
Mieszko Mierunski ad7c15c77b drivers: nrf: Fix nrf uarte fifo_fill function.
Calling fifo_fill function from uart_nrfx_uarte in the same
interrupt more than once, would break previous transmission.

Following fix adds checking if previous data was sent, and
if not, returns 0.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-22 14:06:01 +01:00
Kumar Gala 0916659fb7 adc: remove adc_ti_adc108s102.h
When we removed the adc108s102 driver we missed adc_ti_adc108s102.h

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 18:06:11 -05:00
Kumar Gala c256949bae dts: adc: cleanup CONFIG_ADC_x_NAME
All of the cases of CONFIG_ADC_x_NAME should be DT_ADC_x_NAME.
So go ahead and fix them up.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 18:05:39 -05:00
Kumar Gala d4983db515 dts: adc: cleanup CONFIG_ADC_x_IRQ_PRI
All of the cases of CONFIG_ADC_x_IRQ_PRI should be DT_ADC_x_IRQ_PRI.
So go ahead and fix them up.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 18:05:39 -05:00
Kumar Gala c167789d20 adc: adc_intel_quark_d2000: Pass 0 for IRQ Priority
The Interrupt Controller on the Quark D2000 doesn't support irq priority
to just pass 0 in the for the priority instead of CONFIG_ADC_0_IRQ_PRI.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 18:05:39 -05:00
Kumar Gala 77149642f6 driver: wifi: eswifi: Fix how we get SPI bus
We were hard coding the SPI bus name to "SPI_3".  Instead we should use
DT_INVENTEK_ESWIFI_ESWIFI0_BUS_NAME as its generated from the device
tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 16:01:13 -05:00
Kumar Gala 9f88c0d471 driver: wifi: eswifi: Use DT_ prefixed names
The driver was using the straight alias generated defines, however we
want to use DT_ prefixed defines so its clear that the values are coming
from DT.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 16:01:13 -05:00
Gil Benkö 563af20134 drivers: gpio_gecko: Use emlib API for compatibility
This ensures compatibility with Silicon Labs EXX32 MCU Series 1.

Signed-off-by: Gil Benkö <gil.benkoe@pm.me>
Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2018-11-21 13:42:26 -06:00
Kumar Gala a8d0e5af07 adc: ti_adc108s102: Remove driver as its bit-rotted
Nothing builds this driver and the driver hasn't been updated to the new
ADC api so it does not compile.  Remove it sinces its effectively dead
code.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 12:29:24 -05:00
Erwan Gouriou 121d68f379 drivers/spi: stm32: Use device tree for device clock configuration
Use DT generated symbols to configure clock bus/bits of STM32
SPI devices.

Fixes #10447

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-21 12:28:58 -05:00
Kumar Gala 6d83738e33 dts: spi: cleanup CONFIG_SPI_x_IRQ_PRI
All of the cases of CONFIG_SPI_x_IRQ_PRI should be DT_SPI_x_IRQ_PRI.
So go ahead and fix them up.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 12:27:16 -05:00
Olivier Martin 184753a4e6 drivers: flash: w25q: Add support for page layout
We use the sector size rather than the page size as some
modules that consumes the flash page layout (such as FCB)
assume the page size is the minimal size they can erase.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-11-21 05:08:10 -06:00
Andrzej Głąbek f4675758d7 drivers: serial: Update more DTS-derived labels with DT_ prefix
This is a follow-up to commit b3ca789ef25627bcf7b02ec2aa7fa900fba37227.
Apparently, another driver needed to be updated but this was not caught
up in CI builds at that time.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-21 05:02:21 -06:00
Michael Scott 39843617cb drivers: modem: WNCM14A2A select UART_INTERRUPT_DRIVEN
Modem driver for WNCM14A2A was erroneously leaving the
selection of UART_INTERRUPT_DRIVEN up to CONSOLE_HANDLER.
Now, with the move to the new SHELL backend, this is no
longer happening.

Let's select it from the modem driver, instead of depending
on it.

Let's also add a dependency on SERIAL_SUPPORT_INTERRUPT
which the serial drivers enable to let us know
UART_INTERRUPT_DRIVEN is available.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-21 04:09:23 -06:00
Mieszko Mierunski c9906dd3cf dts: nrf: Remove qdec dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Mieszko Mierunski ac4f588e1f dts: nrf: Remove USBD dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Mieszko Mierunski 94dc637c65 dts: nrf: Remove WDT dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Mieszko Mierunski 80421d3f5f dts: nrf: Remove GPIOTE dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Mieszko Mierunski b370b2ba05 dts: nrf: Remove ADC dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Mieszko Mierunski 34cb33daa8 dts: nrf: Remove UART dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Mieszko Mierunski c1f7e0c955 dts: nrf: Remove SPI dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Mieszko Mierunski 5a10087a25 dts: nrf: Remove TWI dts.fixup defines and use aliases instead.
Changed driver to use alias defines instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Kumar Gala 5f09eae7a1 kconfig: Hide the DesignWare SPI driver on unsupported platforms
When users are configuring applications they are given the option
to enable the DesignWare SPI driver. But they should not be given this
option on SoCs that don't have the DesignWare SPI HW.

This commit hides the driver by default by introducing the config
option HAS_SPI_DW.

Fixes: #10825

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-20 15:50:42 -05:00
Aurelien Jarno 6194b7676c drivers: flash: add flash driver support for Atmel SAM E70
This patch adds a flash driver for the Atmel SAM E70 SoC. The driver has
been kept simple by considering that the flash is only composed of 8-KiB
blocks. Indeed an area at the beginning of the flash might be erased
with a smaller granularity, and the other blocks can also be erased with
a higher granularity. It also only handles the global read/write
protection, not the 128-KiB lock regions. A write error is returned if
a region is locked.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-20 14:11:07 -05:00
Andrei Gansari 35ba3aadc4 drivers: eth_mcux: adding i.mx-rt support
Enables Networking hardware on i.MX-RT type drivers.
Reuses the same eth_mcux driver used by Kinetis family; initialization
sequence refactored to work with this board as well. Unlike Kinetis
family, i.MX has a single ENET interrupt and we need to discriminate
between interrupts using a status register.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2018-11-20 09:54:25 -06:00
Gil Pitney 759b987f72 drivers: serial: Update cc32xx uart interrupt handling
The Zephyr console and shell interrupt processing assumes
a TX interrupt is evoked upon first enabling the TX
interrupt via uart_irq_tx_enable.

This was not the case with the cc32xx uart, coming out of
reset, with FIFO's disabled.

The only way found to achieve this behavior is to fill
the fifo with a non-printable character on initialization.

Also, the uart driver was explicitly clearing TX/RX interrupts in
its isr, which was unnecessary, as the act of reading/writing
did that implicitly.

These fixes allow the cc32xx uart to work with the
current Zephyr console/shell design.

Fixes: #11202

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-11-19 14:01:29 -06:00
Vincenzo Frascino 03c7d9bd49 drivers: wdog: Update CMSDK Wdog driver
The commit 0c2ef4ea3d "drivers:
watchdog: Watchdog API redesign" introduced an API redesign for the
watchdog drivers compliant with Zephyr.

This patch updated the CMSDK Watchdog driver to be compliant with the
new API.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2018-11-19 08:40:48 -06:00
Henrik Brix Andersen e5460c6bcc drivers: watchdog: wdt_sam0: Convert Atmel SAM0 driver to the new API
Convert the Atmel SAM0 watchdog driver to the new watchdog API and
enable DTS support.

This fixes #10914.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-11-19 08:40:15 -06:00
Stanislav Poboril ba3ed24f3d imx: Add IMX IPM driver for i.MX socs
Add driver for i.MX Messaging Unit peripheral which can be used for
i.MX6SoloX, i.MX7D and other i.MX socs.

Origin: Original

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2018-11-19 08:38:38 -06:00
Andrew Boie 9f597d898f i2s: fix bad argument to k_mem_slab_free()
Takes a double pointer. Compiler doesn't catch this.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-16 18:26:03 -05:00
Andrew Boie d5f464c62b i2s: fix slab leak in i2s_buf_write()
A failed return value from i2s_write() requires that the
slab we allocated earlier be freed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-16 18:26:03 -05:00
Tomasz Bursztyka eae05d928e drivers/spi: Adding async mode to SAM and SAM0 drivers
This mode was missing for some reason.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-17 00:25:36 +01:00
Tomasz Bursztyka 27195895b1 drivers/spi: Do not reconfigure at every transaction
If the configuration is already installed, there will no need to
reconfigure the controller all over again.

This was missing for mcux_dspi, mcux_lspi, sam and sam0.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-17 00:25:36 +01:00
Kumar Gala f249a0f4f2 ieee802154: cc2520: Move to DT only config support
Now that the in tree user of cc2520 uses device tree to configure SPI
and GPIO params, we can remove and convert the driver to utilize DT
only.  This means removing the Kconfig options that come from DT and
rename CONFIG_ to DT_ for those options.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-16 14:02:00 -05:00
Kumar Gala 1634cf2248 drivers/spi: Always selecet HAS_DTS_SPI once SPI is enabled
All drivers require DTS for their primary SPI settings.

Removing SPI_[0-9]_NAME config option added some more samples changes.
Usage of these options there was anyway not relevant.

Fixes #11064

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-16 14:02:00 -05:00
Kumar Gala ea198e3e4b ieee802154: mcr20a: Cleanup Kconfig and DT support
Now that all SPI controllers support DTS we can remove the Kconfig
support for non-DTS options.  We also cleanup some defines that should
have be DT_MCR20A_ instead of CONFIG_MCR20A_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-16 14:02:00 -05:00
Tomasz Bursztyka 1b3b0153a6 boards/x86: Use dts for configuring the cc2520 device
Only the SPI bus for now.
Make cc2520's Kconfig aware of DTS on these settings.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-16 14:02:00 -05:00
Kumar Gala fd6e9c6f58 dts: i2c: cleanup CONFIG_I2C_x_IRQ_PRI
The majority of cases of CONFIG_I2C_x_IRQ_PRI should be
DT_I2C_x_IRQ_PRI.  So go ahead and fix them up.  Only the i2c_nios
driver still uses Kconfig for getting priority.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-16 13:57:02 -05:00
Paul Sokolovsky 49bb163756 drivers: serial: uart_cmsdk_apb: Fix interrupt-driven operation
1. There's an expectations that TX ready (i.e. TX buffer space
available) interrupt is a level interrupt, i.e. always active
while there's TX buffer space available. In particular, there's
an expectation that after uart_irq_tx_enable(), the TX interrupt
will immediately fire (assuming free TX buffer space is available).
But CMSDK UART interrupt appears to be edge interrupt, firing only
on buffer state change. So, after irq_tx_enable(), we need to
"bootstrap" interrupt processing by calling user-defined ISR
manually (the ISR will see that TX ready to accept a new char,
will write it there, then we'll get interrupt once TX buffer is
ready again).

2. Interrupts should be acknowledges only after user ISR is called,
because the ISR will check the status of interrupts.

3. Update stale comments.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-11-16 11:48:06 -06:00
Kumar Gala ee9b08d7da drivers: watchdog: Convert Atmel SAM driver to DTS
The majority of bits where already in place, but some minor support
get the driver name from DTS was needed.  Now we select HAS_DTS_WDT
for the driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-16 11:19:36 -06:00
Tomasz Bursztyka 8c4b551be4 drivers/spi: Set CS inactive when releasing unconditionally
In order to avoid changing the signature of spi_context_cs_control
function, which is used in every driver, let's just make it an alias to
a new version.

Fixes #10344

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-16 10:22:30 -05:00
Marek Pieta 39551cfbb8 drivers: pwm: Add power management to pwm_nrfx
Change adds power management to pwm_nrfx.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2018-11-16 15:01:16 +01:00
Patrik Flykt 72378a40f5 drivers/pci: Avoid nested C/C++ comments
Avoid nested C++ comments inside the C comment block due to MISRA-C
rule 3.1. Add ellipsis around the explanatory text instead.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-11-15 17:38:25 -05:00
Andrew Boie d945d32a1e i2s_sam_ssc: fix compiler warning
First argument to a DMA callback is a void pointer.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-15 16:20:36 -05:00
Andrew Boie ad4df685f1 i2s: add i2s_configure() as a system call
Now that k_mem_slabs are tracked as kernel objects,
even though they have no user facing API, we can now
accept a pointer to one in the configure API.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-15 16:20:36 -05:00
Andrew Boie 76a160ba38 i2s_handlers: fix incorrect k_mem_slab_free arg
The API wants a pointer to the memory block pointer for
some reason (even though it's unnecessary to the
implementation).

Compiler won't warn if a void * is passed instead of a
void **.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-15 16:20:36 -05:00
Andrew Boie 42cfd4ff26 kernel: expose k_busy_wait() to user mode
If we just had the kernel's implementation, we could
just move this to lib/, but possible arch-specific
implementations dictate that we just make this a
syscall.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-15 16:20:36 -05:00
Kamil Gawor 446b751609 drivers: gpio: Add reading port/pin in both direction
These changes modify the function of reading port/pin,
function return logical sum of input pin value and
output pin values for a given port. It is now possible
to read the status of pins set as output.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2018-11-15 09:17:15 -05:00
Andrei Emeltchenko 13b02d620c ieee802154: Allow to set debug for RAW_CHANNEL
Allow to set debug also for RAW_CHANNEL and set general debug template
instead of networking one.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-15 08:42:52 -05:00
Kumar Gala 71c3dd11c5 spi: sam: Specify pinmux for chipselect via Kconfig
Move to using Kconfig (like other Atmel SAM drivers do) to specify the
pinmux setting for SAMe70 SoCs.  Updated the sam_e70_xplained board to
set the default in Kconfig.defconfig instead of via board.h

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-15 07:29:44 -06:00
Yannis Damigos 954a943854 drivers: usb_dc_stm32: Use DT to check if USBPHYC exists
Use DT to check if SoC has a USBPHYC controller.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-11-15 07:27:23 -06:00
Maureen Helm f2d8d93269 drivers: sensor: Convert adxl362 to device tree
Converts the adxl362 sensor driver to get the device name and spi slave
properties from the device tree rather than Kconfig. Updates the
build_all test accordingly.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-11-14 23:54:57 -05:00
Andy Ross 7aeeb92535 drivers/timer/xtensa_sys_timer: Add hook for old-style interrupt handling
We still have one platform using (for now) the pre-asm2 integration
where the timer interrupt was handled via custom assembly.  It calls a
function named "_timer_int_handler" always, not the one we register
with IRQ_CONNECT.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-14 19:08:27 -05:00
Aurelien Jarno 16994088fd drivers: entropy: add Atmel SAM entropy generator driver
Tested on the Atmel SAM E70 Xplained board.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-14 12:58:49 -05:00
Savinay Dharmappa cf58f83dd6 boards: xtensa: intel_s1000_crb: Enable SPI Master driver
patch enables SPI Master driver on intel_s1000_crb

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-11-13 18:49:03 -05:00
Savinay Dharmappa 87e5493167 drivers: flash: add a generic spi nor flash driver
This driver is inspired from the w25qxxdv SPI NOR flash driver which was
already implementing the CFI (Common Flash Interface) for its purpose.
To handle other NOR flash a flash id table (as Linux do) which contains
the geometry for a few SPI NOR flash based on their JEDEC ID has been
introduced.
We currently support the following flash:
 - W25Q80
 - W25Q16
 - W25Q32
 - S25FL216K
 - MX25UM512

The read and write functions are able to handle more then one page at a
time and return the number of bytes read or write.
Also because every NOR flash expect to disable the write protection
before writing or erasing, the write enable command is now part of the
write and erase functions.

Signed-off-by: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-11-13 18:49:03 -05:00
Andy Ross 39b2a09f38 drivers/timer: New xtensa timer with tickless support
Rewritten Xtensa CCOUNT driver along the lines of all the other new
drivers.  The new API permits much smaller code.

Notably: The Xtensa counter is a 32 bit up-counter with a comparator
register.  It's in some sense the archetype of this kind of timer as
it's the simplest of the bunch (everything else has quirks: NRF is
very slow and 24 bit, HPET has a runtime frequency detection, RISC-V
is 64 bit...).  I should have written this one first.

Note also that this includes a blacklist of the xtensa architecture on
the tests/driver/ipm test.  I'm getting spurious failures there where
a k_sem_take() call with a non-zero timeout is being made out of the
console output code in interrupt context.  This seems to have nothing
to do with the timer; I suspect it's because the old timer drivers
would (incorrectly!) call z_clock_announce() in non-interrupt context
in some contexts (e.g. "expiring really soon").  Apparently this test
(or something in the IPM or Xtensa console code) was somehow relying
on that on Xtensa.  But IPM is a Quark thing and there's no particular
reason to run this test there.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross f04f797c2b drivers/timer: New, tickless-capable RISC-V machine timer driver
Rewritten driver along the lines of all the other new drivers,
implementing the new timer API.  Structurally, the machine timer is an
up-counter with comparator, so it works broadly the same way HPET and
NRF do.  The quirk here is that it's a 64 bit counter, which needs a
little more care.

Unlike the other timer reworks, this driver has grown by a few lines
as it used to be very simple.  But in exchange, we get full tickless
support on the platform.

Fixes #10609 in the process (the 64 bit timer registers are unlatched
for sub-word transfers, so you have to use careful ordering).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross 03f007edaf drivers/timer: Reworked NRF driver with tickless support
Reworked using the older hardware interface code, but with an
implementation of the new API only.  Much smaller & simpler.

As yet, tested (manually) only on a nrf52_pca10056 board.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross 002a9f4cb7 drivers/timer/hpet: Completely new, simplified, tickless-capable driver
Rewritten along the lines of ARM SysTick.  Implements only the new,
simplified API.  MUCH smaller.  Works with tickless pervasively.  No
loss of functionality.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross 9ff98f797a drivers/timer: Add more default stubs
Many drivers won't need to implement z_clock_idle_exit() or
sys_clock_disable(). Make those weak stubs too.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross c0a184c067 drivers/timer: Select tickless via driver kconfig flag
Add a TICKLESS_CAPABLE kconfig variable which is used by the kernel to
select tickless mode's default automatically on drivers that support
it (rather than having to set the default per-board).  Select it from
the ARM SysTick and Intel HPET drivers.

Also remove the old qemu_cortex_m3 default settings which this
replaces.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross 0f444c84e5 drivers/timer: Add a standard workaround for known qemu issues
Qemu doesn't like tickless.  By default[1] it tries to be realtime as
vied by the host CPU -- presenting read values from hardware cycle
counters and interrupt timings at the appropriate real world clock
times according to whatever the simulated counter frequency is.  But
when the host system is loaded, there is always the problem that the
qemu process might not see physical CPU time for large chunks of time
(i.e. a host OS scheduling quantum -- generally about the same size as
guest ticks!) leading to lost cycles.

When those timer interrupts are delivered by the emulated hardware at
fixed frequencies without software intervention, that's not so bad:
the work the guest has to do after the interrupt generally happens
synchronously (because the qemu process has just started running) and
nothing notices the dropout.

But with tickless, the interrupts need to be explicitly programmed by
guest software!  That means the driver needs to be sure it's going to
get some real CPU time within some small fraction of a Zephyr tick of
the right time, otherwise the computations get wonky.

The end result is that qemu tends to work with tickless well on an
unloaded/idle run, but not in situations (like sanitycheck) where it
needs to content with other processes for host CPU.

So, add a flag that drivers can use to "fake" tickless behavior when
run under qemu (only), and enable it (only!) for the small handful of
tests that are having trouble.

[1] There is an -icount feature to implement proper cycle counting at
the expense of real-world-time correspondence.  Maybe someday we might
get it to work for us.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Andy Ross c535300539 drivers/timer: New ARM SysTick driver
Newer, and much smaller driver written to the new timer API.  Supports
all the features the old one did (including shutting off the clock
when clock_always_on is disabled), should be faster in practice, and
should be significantly more accurate due to the "lost cycle" trick
applied in z_clock_set_timeout().

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05:00
Kumar Gala 9730ca1852 wifi: winc1500: Add Device Tree support
Add a dts binding for the Atmel WINC1500 WIFI chip.  Update the
quark_se_c1000_devboard to utilize this binding as well as the wifi
sample app.

We now get all the GPIOs related to the Atmel WINC1500 from the device
tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-13 14:12:18 -05:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Andrzej Głąbek d4a17b4085 soc: cc2650: Update DTS-derived labels with DT_ prefix
Update a couple of labels generated from DTS used directly (not through
dts_fixups) in TI CC2650 system initialization code and a few drivers
for this SoC.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Andrzej Głąbek 8dd11d9736 drivers: serial: Update DTS-derived labels with DT_ prefix
Update a couple of labels generated from DTS used directly (not through
dts_fixups) in some serial drivers, to the reflect recent changes made
to the extracting script.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
qianfan Zhao 84f9dc7143 pinmux: stm32f4: add MCO pin multiplexing helper
Add MCO1(PA8) and MCO2(PC9) pin multiplexing helper on stm32f4 series

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-11-13 07:11:15 -06:00
qianfan Zhao f20a63ca05 clock_control: stm32: add supports for MCO output
config MCO1 and MCO2(if hardware supports) based on
Kconfig when startup.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-11-13 07:11:15 -06:00
Erwan Gouriou bd7387947e drivers/gpio: stm32: Remove redundant AFIO bit for STM32F1
Specific code is present GPIO_DEVICE_INIT_STM32 in
GPIO_DEVICE_INIT_STM32 to handle LL_APB2_GRP1_PERIPH_AFIO bit.
Though, this bit is already included in device tree information,
in clocks property, 'bits' field, which carries for each GPIO,
both LL_APB2_GRP1_PERIPH_GPIOX and LL_APB2_GRP1_PERIPH_AFIO.
Hence, it is already taken into account in
CONFIG_GPIO_STM32_GPIO##__SUFFIX##_CLOCK_BITS and it is redundant
to handle it in GPIO_DEVICE_INIT_STM32 macro.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-13 07:09:35 -06:00
Kumar Gala a134438840 sensors: bmi160: Add DTS support
Convert the BMI160 to use Device Tree to get SPI and GPIO params instead
of Kconfig.  Updated samples, tests, and arduino_101_sss board support
for this.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-13 10:23:22 +01:00
Jukka Rissanen 55f009d8e5 drivers: eth: e1000: Free packet after sending it
The error check was wrong, if we could send the packet then
we free it. If sending fails, then let the caller to decide
what to do with the packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-13 10:35:39 +02:00
Anas Nashif cdc4d534bf drivers: add semicolon after LOG_MODULE_REGISTER
Causes build failures after macro was updated recently.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-12 13:50:21 -05:00
Oleg Zhurakivskyy 064074e62b drivers: eth: e1000: Use system log macros
System log macros now include function names, use them.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-11-12 10:03:51 -05:00
Oleg Zhurakivskyy 3645a7a40d drivers: eth: e1000: Enable multicast
Add "Multicast Promiscuous Enabled" (RCTL_MPE) bit definition and
use it for the receive control register (RCTL) initialization.

Multicast needs to be enabled in order for IPv6 auto-configuration
to succeed.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-11-12 10:03:51 -05:00
Oleg Zhurakivskyy 3c52b11951 drivers: eth: e1000: Enable interrupt in a safe way
The initial sequence was wrong and led to the missing interrupt
problem with netdev backends where the incoming traffic
appears immediately (tap).

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-11-12 10:03:51 -05:00
Oleg Zhurakivskyy 69be780db4 drivers: eth: e1000: Call ethernet_init() on init
The driver should call ethernet_init() in order to initialize
Ethernet L2 stack.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-11-12 10:03:51 -05:00
Erwan Gouriou e886d16f67 drivers/serial: stm32: factorize device declaration
Following use of clock information from device tree,
factorize devices declarations.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-12 08:17:28 -05:00
Erwan Gouriou d76a5592e4 drivers/serial: stm32: Get clocks information from device tree
Provide CONFIG macros for clocks bits and bus properties in fixup
files and use them to simplify logic in uart devices instanciation
code

Fixes #10448

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-12 08:17:28 -05:00
Kumar Gala c0a3c6d4fc adc: adc_dw: Remove dead code related to undefined Kconfig symbols
CONFIG_ADC_DW_REPETITIVE and CONFIG_ADC_DW_DUMMY_CONVERSION aren't
defined anywhere so remove the associated code for these Kconfig
symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-10 15:18:24 -05:00
Andrzej Głąbek 4750cf3b7b bluetooth: controller: nrf5: Reorder used PPI channels
The channels assigned to the controller are reordered so that the ones
previously used and now available for other purposes have continuous
numbers. When the controller can take advantage of the pre-programmed
PPI channels (when TIMER0 is used as the event timer), the now free
channels are 0-4, when it cannot, it is the channel 0.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-10 12:39:40 -05:00
Krzysztof Chruscinski 97345dbb1b logging: Fix errors in log usage
Couple of findings which were revealed after changing
LOG_MODULE_REGISTER macro:
- missing semicolons after LOG_MODULE_REGISTER()
- missing LOG_LEVEL defines
- other

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-11-10 12:38:29 -05:00
Krzysztof Chruscinski 0df41da4e9 drivers: ieee802154: Fix log configuration in kconfig
Log configuration was included only in case NET_L2_IEEE802154 was
enabled. In case of open thread this is not the case.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-11-10 12:38:29 -05:00
Jukka Rissanen 421505c7e3 net: qemu: Allow SLIP or normal ethernet connectivity
Introduce new Kconfig option for selecting either slip or ethernet
connectivity to host.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-11-10 09:13:45 -05:00
Himanshu Jha cb350e9399 sensors: lis2dh: Handle return value of lis2dh_reg_read_byte function
Provide necessary error handling for `lis2dh_reg_read_byte` function
which might fail.

Also, use a common `status` variable to be used for storing the
error code.

Fixes #10590
Coverity-CID: 188733

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-09 16:11:26 -06:00
Sathish Kuttan 646f06eaf7 drivers: neural_net: Use correct Kconfig variable
The Kconfig variable for selecting neural network accelerator driver(s)
was changed from NEURAL_NET to NEURAL_NET_ACCEL
The CMakeLists.txt however, was not updated to use the updated variable
This commit updates CMakeLists.txt to include neural_net if
CONFIG_NEURAL_NET_ACCEL is defined.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-09 16:52:32 -05:00
Tomasz Bursztyka d658e03488 drivers/spi: Remove unused legacy options
These have been osbolete for some time already.

Fixes #11064

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-09 05:25:11 -06:00
Tomasz Bursztyka aa6a951c5a drivers/spi: Enable HAS_DTS_SPI for Intel SPI driver
All primary settings should be set via DTS.

Fixes #11064

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-11-09 05:25:11 -06:00
Martin Bertsche 9892f40204 gpio: stm32 use dts extracted information to populate gpio instances.
The information extracted from the device tree is now used to initialize
GPIO device instances. Up until now the GPIO device driver made no use
of this information. Actual instance creation is still controlled using
the Kconfig method. Missing GPIO device tree nodes were added in the
process for STM32L073, STM32F413 and STM32F373.

The information for gpio instance initialization has already been
present for supported STM32 SoCs but remained unused. Changes in the
device tree had no effect on GPIO functionality and was essentially
redundant. Using the device tree for hardware description seems
plausible and less painful than a myriad of defines in some SoC
description header.

The change was implemented under the assumption that current device
trees provide a correct description of the SoCs. Base register addresses
and RCC register bits were not explicitly checked for each device.

Manual tests were executed on:
	- NUCLEO-F103RB
	- STM32F429I-DISCO
	- STM32F746G-DISCO
	- NUCLEO-F767ZI

Manual tests consisted of blinky on different GPIOs and pins on each
board.

sanitycheck was executed for all STM32 based boards

Fixes: #10629

Signed-off-by: Martin Bertsche <martin72216@googlemail.com>
2018-11-09 04:49:59 -06:00
Piotr Mienkowski d9e2171aa9 drivers: flash_gecko: Add flash driver for SiLabs Gecko SoCs
Tested with SLWSTK6061A / BRD4250B wireless starter kit.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2018-11-08 17:56:44 -05:00
Erwan Gouriou 3a1f4650f1 boards: stm32f469i_disco: Conform to default configuration guidelines
Update stm32f469i_disco configuration to match with
default configuration guidelines:
-Configure available connectors
-Update yaml file

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-08 17:16:21 -05:00
Erwan Gouriou deee15553e boards: stm32f723e_disco: Conform to default configuration guidelines
Update stm32f723e_disco configuration to match with
default configuration guidelines:
-Configure available connectors

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-08 17:16:21 -05:00
Erwan Gouriou b89317d14c boards: stm32f769i_disco: Conform to default configuration guidelines
Update stm32f769i_disco configuration to match with
default configuration guidelines:
-Configure available connectors

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-08 17:16:21 -05:00
Erwan Gouriou b3645eb62b boards: stm32l496g_disco: Conform to default configuration guidelines
Update stm32l496g_disco configuration to match with
default configuration guidelines:
-Deactivate features by default
-Configure available connectors

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-08 17:16:21 -05:00
Erwan Gouriou 01a0b50c94 boards: disco_l475_iot1: Conform to default configuration guidelines
Update disco_l475_iot1 configuration to match with
default configuration guidelines:
-Deactivate features by default
-Configure available connectors

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-08 17:16:21 -05:00
Sathish Kuttan cf27979d8b drivers: neural_net: Add cmake files
Added cmake files for neural_net acceleration drivers

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-08 17:08:19 -05:00
Sathish Kuttan fe6bddf7d3 kconfig: intel_s1000: Add neural_net Kconfig
Added Kconfig files for Intel neural network accelerator
(GNA) driver

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-08 17:08:19 -05:00
Sathish Kuttan eeb5c02168 drivers: intel_gna: Driver for Intel GNA
Driver implementation for Intel GNA Neural Network Accelerator

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-08 17:08:19 -05:00
Aurelien Jarno 7ef3ddce45 drivers: usb_dc_sam: use original logger functions
Rename USB_{DBG,ERR,INF,WRN} into LOG_{DBG,ERR,INF,WRN}. This driver has
been missed from PR #11001 as it has been committed after.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-08 16:33:23 -05:00
Gil Pitney 508c941d32 drivers: wifi: simplelink: fix Coverity issue in getaddrinfo()
Check for case where host == NULL but service != NULL
could have resulted later in a NULL dereference.

Coverity-CID: 189516
Fixes #11090

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-11-08 23:23:23 +02:00
Andrei Emeltchenko 93bd26343e usb: logs: Rename USB_WRN to LOG_WRN
Since logger is now suitable for our logs use it directly.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-08 08:35:20 -05:00
Andrei Emeltchenko f22060cdbe usb: logs: Rename USB_INF to LOG_INF
Since logger is now suitable for our logs use it directly.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-08 08:35:20 -05:00
Andrei Emeltchenko 17f7abd3dc usb: logs: Rename USB_ERR to LOG_ERR
Since logger is now suitable for our logs use it directly.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-08 08:35:20 -05:00
Andrei Emeltchenko 92c7ab74c0 usb: logs: Rename USB_DBG to LOG_DBG
Since logger is now suitable for our logs use it directly.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-08 08:35:20 -05:00
Sean Nyekjaer c206b0239f drivers: gpio: shell: rectify gpio get error msg
Previous the error for get was:
- Wrong parameters for set
Now:
- Wrong parameters for get

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
2018-11-08 08:25:06 -05:00
Sathish Kuttan c91faf9008 drivers: dmic: Intel PDM digital mic driver
Added an implementation of driver for Intel PDM digital microphone
controller .

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-08 00:40:28 -05:00
Maureen Helm f379abfe47 drivers: sensor: Fix missing case break in fxos8700 driver
Fixes a missing case break in the fxos8700 sensor driver, caught by
Coverity.

Coverity-CID: 189517

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-11-07 19:23:46 -05:00
Himanshu Jha b7515ab015 drivers: audio: Use ARRAY_SIZE helper macro
Use ARRAY_SIZE helper macro to compute size of array rather
than hardcoding.

Also, remove unnecessary variable to store the size which is
now useless.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 16:56:33 -05:00
Himanshu Jha d0a98b7cf9 drivers: Remove redundant semicolon
Remove the redundant semicolon used as a terminator in
`if`, `switch`, `while` statements.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:34:06 -05:00
Aurelien Jarno 6b6e54321a drivers: usb: add usb device driver for Atmel SAM E70 family
This patch adds a USB device driver for the USBHS device that can be
found on Atmel SAM E70 SoC family. Only the FIFO mode is supported
(as opposed to DMA). It supports LS, FS and HS modes, but defaults to
FS mode as Zephyr does not fully support HS mode yet.

Tested examples on an Atmel SMART SAM E70 Xplained Board:
* usb/cdc_acm
* usb/hid-mouse
* usb/mass

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-06 16:32:35 -05:00
Erwan Gouriou 9df3a1f67f drivers/i2c: stm32: get clock bits/bus from dts files
Get STM32 I2C clocks bus and bits information from
device tree files.

Fixes #10435

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-11-06 16:14:13 -05:00
Himanshu Jha 4a5042dd77 sensor: lis2mdl: Handle return value of i2c_burst_read
i2c_burst_read can fail during read/write procedure. Therefore,
add a sanity check for its return value.

Fixes #11101
Coverity-CID: 189505

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-06 14:10:51 -06:00
Kumar Gala bfc4281cc0 arm: kinetis: Add basic DTS support for TRNG
Add dts binding and info for TRNG device and enable basic support to
get the device name from DTS.  We leave for now the base addresses
coming from the MCUX HAL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-06 08:49:50 -06:00
Kumar Gala 727a9a7f99 arm: kinetis: Add basic DTS support for RNGA
Add dts binding and info for RNGA device and enable basic support to
get the device name from DTS.  We leave for now the base addresses
coming from the MCUX HAL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-06 08:49:50 -06:00
Kumar Gala 6ce4a08c97 drivers: entropy: Get device name from dts if supported
If we have DTS support for an entropy driver we should get the name
generated from DTS ('label' property on the entropy device node).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-06 08:49:50 -06:00
Vinayak Kariappa Chettimada ebaabba834 clock_control: nrf5: Ensure HF & LF running before calibration
Fix RCOSC calibration initiation to ensure LF clock is
running; and the HF clock is running with crystal before
triggering the actual calibration in ISR.

Fixes #10811.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-11-05 19:07:12 +01:00
Kumar Gala ac7da0b65c gpio: ti cc32xx: Add device tree support for GPIO
Convert gpio_cc32xx driver over to using device tree. Added binding
files, updates to dts for various SoCs that use cc32xx.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-05 11:08:35 -06:00
Dennis Wildmark e60a6e9256 drivers: lsm303dlhc_accel: support for sensor_attr_set
Driver for LSM303DLHC accelerometer now supports API function
sensor_attr_set for attribute SENSOR_ATTR_SAMPLING_FREQUENCY.

Signed-off-by: Dennis Wildmark <d.wildmark@gmail.com>
2018-11-05 10:41:51 -06:00
Anas Nashif c2c6a6a245 qemu_riscv32: use hifive1 configuration
Use hifive1 configuration for this qemu and set
SYS_CLOCK_HW_CYCLES_PER_SEC to 10000000

Fixes #10043

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-05 11:00:38 -05:00
Kumar Gala ddc2a3d9df drivers: spi_sam0: move sercom pad info to dts
Move the setting of the SERCOM PAD for dipo/dopo for the spi driver
into device tree out of board.h

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-05 10:05:47 -05:00
Kumar Gala 6d08958ad5 drivers: uart_sam0: move sercom pad info to dts
Move the setting of the SERCOM PAD for rxpo/txpo for the uart driver
into device tree out of board.h

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-05 10:05:47 -05:00
Anas Nashif c41b236a14 shell: add PCI shell
Add basic 'lspci' command to list PCI devices. This command can be
enabled with the new Kconfig PCI_SHELL.

Example:

uart:~$ lspci
0:1 8086:7010 class: 0x1, 1, 4, I/O, addrs: 0xC000-0xC00F, IRQ -1

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-05 09:32:38 -05:00
Kiril Zyapkov 7a602fc615 drivers: uart_stm32: fix ORE hogging the CPU
If data is received before an IRQ handler was set and enabled,
hardware sets the ORE flag. Once set, the IRQ routine starts
hogging the CPU until ORE is cleared. This change will clear
the flag when user code attempts to drain incoming data.

Signed-off-by: Kiril Zyapkov <k.zyapkov@allterco.com>
2018-11-05 09:01:30 -05:00
Sathish Kuttan 7e3a457308 drivers: i2s_cavs: Add bidirectional I2S support
Added bidirectional I2S support for Intel S1000

- Added implementation for I2S receive mode
- Extended driver instances to support 3 I2S ports
- Added DMA channel mappings for upto 4 I2S ports
- Utilized k_msgq to track buffers through the driver
    - Allocate buffers for audio reception in the driver
    - Free buffers after audio transmission in the driver
- Perform buffer reload for DMA after every reception/transmission
- Removed unused Kconfig variables
    - I2S_CAVS_TX_BLOCK_COUNT
    - I2S_CAVS_RX_BLOCK_COUNT

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-05 08:48:36 -05:00
Sathish Kuttan 9c52171750 drivers: dma_cavs: add buffer refresh/reload
Added a mechanism to refresh DMA buffers without the
need to call the "configure" API every time.
The reload is done after every DMA completion.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-05 08:48:36 -05:00
Andrei Emeltchenko 767b4ec6b7 usb: usb_dc_nrfx: Remove dead code
Fix deadcode warning.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-11-05 08:46:55 -05:00
Aurelien Vouaillat 6282320427 drivers: i2c: i2c_nrfx_twi and twim: Return -EBUSY when I2C bus is busy
Return -EBUSY instead of -EIO

Signed-off-by: Aurelien Vouaillat <aurelien.vouaillat@proglove.de>
2018-11-05 14:23:17 +01:00
Armando Visconti 7a18efefbc drivers: dma: stm32f4: Fix typo introduced when removing board.h
Following commit removed board.h but forgot to add soc.h:

  "drivers: Remove board.h include"

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-11-05 07:49:19 -05:00
Flavio Ceolin aecd4ecb8d kernel: Change k_poll_signal api
k_poll_signal was being used by both, struct and function. Besides
this being extremely error prone it is also a MISRA-C violation.
Changing the function to contain a verb, since it performs an action
and the struct will be a noun. This pattern must be formalized and
followed and across the project.

MISRA-C rules 5.7 and 5.9

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-04 11:37:24 -05:00
Daniel Leung e4aa946c55 timer: xtensa_sys_timer: set compare register at init
Since CCOMPARE* registers have undefined values after reset,
set compare value first before enabling timer interrupt.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-11-03 12:40:33 -04:00
Kumar Gala 751b02a49c drivers: serial: uart_miv: Convert to use DTS
Update the uart_miv driver to get params like name, addr, baud-rate,
clock freq from DTS generated defines.  Fixup related board and soc code
as needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-03 06:58:23 -04:00
Daniel Leung a87a6d82ac soc: apollo_lake: fix build errors for GPIO due to DTS changes
The DTS changes introduced in 7ae220c845
changes the naming of GPIO related macros. This updates the usage
of previous macros via DTS fixup.

Fixes #10993

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-11-02 21:58:02 -04:00
David B. Kinder ee47f7fb7a doc: fix kconfig misspellings
Fix misspellings in Kconfig files that show up in the configuration
documentation (and make menuconfig screens).

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-02 17:58:16 -04:00
Anas Nashif aab35b34ac drivers: spi_dw: remove unused LOG_DOMAIN define
This define for the log domain in obsolete and not being used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-02 15:31:44 -05:00
Subramanian Meenakshi Sundaram 4e1179bba5 drivers: watchdog: Adding watchdog support for sam SOC
Adding watchdog driver for sam SoC. The current implemntation just
diables the watchdog on device boot.
This PR adds the following support for SAM3X, SAM4S and SAME70
1. Activate processor reset
2. Activate all reset
3. Generate interrupt on watchdog timer expiration.

Signed-off-by: Subramanian Meenakshi Sundaram <subbu147@gmail.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-02 15:09:22 -05:00
Jonas Norling cb53a1a2d5 drivers: clock_control: Remove asserts that break LF clock on nRF5
There are two asserts in the ISR for clock events on the nRF5 that
appear to be accidental.

The first assert fails if there are any LF clock started events, which
there will be when starting up the RC oscillator with calibration.

The second assert fails when we decrement the refcount on the HF
oscillator after finishing a calibration. There will typically be
users left of the HF oscillator, so _m16src_stop() doesn't actually
stop it and thus doesn't return 0.

This code typically works fine because it's not built with asserts
enabled by default. Can be reproduced on a BBC microbit with the
default config plus CONFIG_ASSERT=y.

Signed-off-by: Jonas Norling <jonas.norling@greeneggs.se>
2018-11-02 12:25:06 -04:00
Anas Nashif b0ebe0dcbd drivers: interrupt_controller: fix cmake file
We were trying to build a file that does not exist, should include .S
file instead of .c

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-02 09:39:15 -04:00
Anas Nashif 4071f2c8bb drivers: timer: use weak functions after declaration
Got a warning when building with XCC.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-02 08:37:27 -04:00
Anas Nashif 238b664a89 intel_s1000: include soc.h where needed
We still need defines from soc.h for some of the drivers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-02 08:37:27 -04:00
Flavio Ceolin 20e5c257f8 drivers: sensor: Fix syscall name
syscall sensor_sample_fetch was erroneously being defined as
sensor_sample_sample_fetch.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-01 14:40:30 -07:00
Kumar Gala 95776d945c drivers/display: mb_display: Move gpio defines to driver
Since the mb_display driver is specific to the microbit we can move
the GPIO pin defines from board.h into the driver.  This lets us remove
one of the few remaining drivers that is including board.h

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 15:58:51 -05:00
Kumar Gala aa2bdbe322 drivers: Remove board.h include
We either don't need board.h in the driver or we should be include soc.h
instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 13:21:11 -04:00
Himanshu Jha b8c19d8c75 util: Add GENMASK helper macro definition
Macro is used to create contiguous bitmask between the
arguments passed to the macro.

BITS_PER_LONG is computed as the multiplication of predefined
macros `__CHAR_BIT__` and `__SIZEOF_LONG__`.

Both gcc and clang support these predefined macros.

With this change, replace the redundant defintions of
GENMASK with the new generic macro available.

Fixes #10843

Suggested-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-01 13:40:01 +01:00
Daniel Leung d70eb98537 i2s: i2s_cavs: fix dma_tx_callback function signature
The dma_tx_callback() function signature is different than the one
required by struct dma_config. So change the signature to fix
a compiler warning.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-10-31 22:04:20 -04:00
Diego Sueiro 4ce6555c1d drivers: Introduce Silabs i2c shim driver
Adds the I2C shim driver for Silabs Gecko Devices.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-10-31 09:00:38 -05:00
Diego Sueiro 3b0260939c drivers: Introduce Silabs leuart shim serial driver
Adds the Low Energy UART shim serial driver for Silabs Gecko Devices.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-10-31 09:00:38 -05:00
Anas Nashif 04c85e64c1 sensors: qdex_nrfx: move to new logger
Move to new logger and use sensor log level instead of our own.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-31 08:34:36 -04:00
Pavel Kral a19726ee1e logger: console: init rtt only once
As RTT is used by more subsystem in Zephyr, initialization is moved
from RTT console and RTT logger backend to common kernel init phase.

Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
2018-10-31 12:47:53 +01:00
Pavel Kral 1a583fa8be ext: debug: segger: Add USE_SEGGER_RTT that enables RTT libraries.
This option allows to explicitly include Segger RTT libraries and
enables use of it for various subsystems. It is disabled by
default as it consumes more RAM.

Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
2018-10-31 12:47:53 +01:00
Pavel Kral 2c84fd2631 ext: debug: segger: Terminal sharing using SEGGER_RTT_LOCK/UNLOCK macros
This commit allows to share default RTT (terminal) buffer with various
Zephyr subsystems.

Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
2018-10-31 12:47:53 +01:00
Kumar Gala d505d9a8ca driver: sensor: bmm150: Use SENSOR_CHAN_MAGN_XYZ
Driver should be using SENSOR_CHAN_MAGN_XYZ as SENSOR_CHAN_MAGN_ANY has
been deprecated for a while.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-30 15:28:41 -05:00
Paweł Zadrożniak 7791f58a15 drivers: usb: nordic: Fix max packet size handling
This commit fixes the issue with non-default max packet size (<64).
The max packet size value was not passed to low-level driver
in norfic hal (nrfx_usbd) causing 64-byte being send regardless of
configured endpoint size. Size mismatch results in communication
error on Linux hosts.

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2018-10-30 18:14:17 +01:00
Niranjhana N 9e895acf4e drivers: wifi: fix an unchecked return
Log error and return false if recv()
has not received packet in the buffer.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-10-30 14:18:28 +02:00
Satya Bhattacharya 7d886e8b6e sensor: isl29035: Unchecked return value
Check the return value of i2c_reg_read_byte() and return
if unable to read the register
Coverity-CID: 188740

Fixes #10585

Signed-off-by: Satya Bhattacharya <satyacube@gmail.com>
2018-10-30 05:56:18 -05:00
Piotr Zięcik cc1b92e2e8 drivers: entropy: Use likely()/unlikely() macros to speed up the API
This commit introduces usage of likely()/unlikely() macros in order
to speed up the entropy_get_entropy_isr() API.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik 615efcce69 drivers: entropy: nrf5: Remove entropy_nrf_get_entropy_isr() function
The entropy_nrf_get_entropy_isr(), which is specific to this driver,
is in fact equivalent of generic entropy_get_entropy_isr(..., 0).

This commit removes the entropy_nrf_get_entropy_isr() function
and replaces its usage by call to generic entropy API.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik 31dfc2eaad drivers: entropy: nrf5: Save few cycles removing excessive dereferences.
This commit optimizes access to device data using direct reference
instead of relying on the driver_data field in the device structure.

Such approach saves few cycles on time-critical paths.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik c24aca0229 drivers: entropy: nrf5: Replace random number pool implementation
The old algorithm managing random number pools was inefficient and
prone to race conditions. Moreover, its behaviour was not compatible
with the API (provided buffers were filled from the end, leaving
beggining of the buffer untouched if there was not enough random data).

The new implementation is a bit faster and it is race-free as long as
all callers of the entropy_get_entropy_isr() are executed in
"run-to-completion" mode.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik 0db5b24907 drivers: entropy: nrf5: Pass device data to the ISR
This commit changes the argument passed to ISR to the pointer
to device data structure, removing one dereference in the interrupt
handler.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik f5a614f620 drivers: entropy: nrf5: Cleanup function naming
This commint replaces function names by more accurate ones.
For example, the isr(), was renamed to rng_pool_put(), which
clerarly indicates what this function is doing.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik 42a38e1172 drivers: entropy: nrf5: Fix hardware state management
The entropy_nrf5_get_entropy_isr(...,  ENTROPY_BUSYWAIT)
unconditionally started and stopped hardware random number generator
disrupting management of random data pools implemented by the driver.

Moreover, simultaneous call to mentioned function from different
priorities led to hangup of lower priority call as hardware was
stopped by higher priority call while the other one waited for data.

This commit solves mentioned problems by moving the responsibility
for stopping hardware to the interrupt handler. As result hardware
is stopped only when there is no blocking calls to the
entropy_nrf5_get_entropy_isr() as well as all random data pools
are full.

This commit also fixes interrupt management in the mentioned
function, as previous implementation unconditionally enabled
interrupt causing problems similar to the described above.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik 4d402668a0 drivers: entropy: nrf5: Fix race condition on hardware access
Neither entropy_nrf5_get_entropy_isr() nor isr() protected
access to hardware. As result in some situations a random value
could be "stolen" by a higher priority call  interrupting one
of the mentioned functions.

This commit solves this problem by introducing random_byte_get()
which accesses hardware atomically.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik 4baf5876a1 drivers: entropy: nrf5: Use nrf_rng HAL for all hardware access
The nrf_rng HAL uses barriers on SoCs which need them to ensure
that all register writes will reach the peripheral immediately.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Armando Visconti 1c7a971972 drivers/i2s_ll_stm32.c: Fix dma_callback() signature
Align the dma_callback() signature to the new one in order
to avoid warnings during compilation.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-10-30 04:28:21 -05:00
Jan Van Winkel a466154dcc drivers: display: Added DTS support for ili9340
Added device tree support for ili9340 display driver

Part of #10894

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-10-29 22:19:58 -04:00
Kumar Gala ef1cc3f488 bluetooth: hci: spi: Fix compile warning
drivers/bluetooth/hci/spi.c: In function ‘bt_spi_open’:
drivers/bluetooth/hci/spi.c:475:31: error: passing argument 2 of ‘gpio_init_callback’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  gpio_init_callback(&gpio_cb, bt_spi_isr, BIT(GPIO_IRQ_PIN));
                               ^~~~~~~~~~
In file included from drivers/bluetooth/hci/spi.c:9:0:
include/gpio.h:247:20: note: expected ‘gpio_callback_handler_t {aka void (*)(struct device *, struct gpio_callback *, long unsigned int)}’ but argument is of type ‘void (*)(struct device *, struct gpio_callback *, unsigned int)’
 static inline void gpio_init_callback(struct gpio_callback *callback,
                    ^~~~~~~~~~~~~~~~~~

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-29 10:52:00 -04:00
Loic Poulain 25120f3cc2 boards: disco_l475_iot1: Enable es-WiFi driver
Automatically enable es-WiFI driver when WIFI is enabled.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Loic Poulain 0b8fde39e4 driver: wifi: Add inventek es-WiFi driver
es-WiFi compatible modules use IWIN AT command set.
This driver is split into several layers:
- bus layer: interface to transmit AT commands (SPI, USB, UART...)
- core layer: es-WiFi module management (state, scan...)
- offload layer: TCP/IP offload operations (connect, listen...)

This driver has been tested with stm32l4 disco iot board
(disco_l475_iot1) and the wifi sample:

$ select wifi
$ scan
$ connect "CISCO" 5 password
$ select net
$ tcp connect 192.168.1.21 4242
$ tcp send HelloWorld!

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Michael Scott 25d5736e69 drivers: modem: wncm14a2a: fix void ptr math warning
I have no idea what I was thinking when I wrote this.
But, it's an easy fix to remove the void * entirely.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-10-29 09:14:26 -04:00
Michael Scott 38bdc9f532 drivers: modem: migrate modem shell to new shell API
Convert modem-shell to use the new shell API.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-10-29 08:40:40 -04:00
Anas Nashif 203948e156 sensors: move grove sensors under drivers/sensor
Grove devices are sensors, so no need to have them under their own
category.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-28 11:46:36 -04:00
Anas Nashif d2c8d52336 grove: lcd: move grove lcd driver to drivers/display
Move to display drivers where it belongs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-28 11:46:36 -04:00
Aurelien Jarno 8d204f85af drivers: entropy nRF5x: hide the driver on non-nRF boards
The nRF5x entropy driver does not depends on SOC_FAMILY_NRF is therefore
visible and selectable non-nRF5x SoCs. Fix that.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-10-26 16:26:37 +01:00
Kumar Gala 1becbfcb8b drivers: display: ssd1673: Fixup dts support
There were several issues in the dts binding for the ssd1673 display:
* binding file mixed description & generation up together
* Use of BASE_LABEL
* orientation-flipped should have been of type boolean

Update the binding file to reflect these changes, and made associated
changes to dts_fixup.h and driver as needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-26 08:13:04 +01:00
Vinayak Kariappa Chettimada a2b26b9811 clock_control: nRF5x: Workaround Errata [192] LFRC frequency offs
Workaround the Errata [192] CLOCK: LFRC frequency offset
after calibration.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-10-25 23:36:53 +01:00
AJ Palmer 94099df5c8 boards: arm: nucleo_f746zg: Added SPI support
Added support for SPI 1 available from the arduino connector (plus an
extra gpio). Tested against samples/sensor/bme280.

Signed-off-by: AJ Palmer <ajpcode@hotmail.com>
2018-10-25 07:33:30 +01:00
Sebastian Bøe b9c125f64c kconfig: Hide the DesignWare I2C driver on unsupported platforms
When users are configuring nRF applications they are given the option
to enable the DesignWare I2C driver. But they should not be given this
option because nRF SoCs do not have DesignWare I2C HW.

This commit hides the driver by default by introducing the config
option HAS_I2C_DW.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-10-25 07:32:05 +01:00
Himanshu Jha dab64724eb drivers: crypto: Fix precedence issue in if statement
The logical NOT operator has a higher precedence than bitwise
AND operator. Therefore to make the test in if statement
correct, add parenthesis around the operands of bitwise
AND operator.

Found using Coccinelle.

Semantic Patch Language (SmPL) used:

<smpl>

@@
expression x;
constant C;
@@

- !x & C
+ !(x & C)

</smpl>

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-10-25 07:23:49 +01:00
Kumar Gala 060b8c1512 drivers: ssd1306: fixup dts support
A few issues with the dts support for the SSD1306 display driver:
1. binding file mixed description & generation up together
   - rename most uses of generation to description and add proper
     generation field into yaml
2. Drop use of BASE_LABEL, this shouldn't be used by most bindings
3. dts defines that are being assumed in driver aren't correct.  We
   should be using a dts_fixup.h in the sample to map the generated
   defines to those used in the driver.  We remove the incorrect
   defines that the driver assumes right now.
4. Fixup 'segment-remap' and 'com-invdir' properties that are booleans
   in the binding file and associated code changes.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-24 16:42:35 +01:00
Christian Taedcke 5575594ce9 drivers: spi_ll_stm32: Enable SPI driver for F7 family
Enables SPI driver for STM32F7 SoCs

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2018-10-23 09:19:15 +01:00
Christian Taedcke 811fe2d5c7 drivers: pinmux: stm32f7: Add SPI2 pinmux entries
This patch adds the SPI2 pinmux entries for the STM32F7 series.

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2018-10-23 09:19:15 +01:00
Christian Taedcke 2e06fd50fd drivers/rtc: Enable RTC driver for STM32F7 series
Enable RTC driver for STM32F7 series.

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2018-10-23 09:19:15 +01:00
Jukka Rissanen 82fa5bcf59 drivers: eth: native_posix: Allow non-root access
Change the default behaviour of the host network interface
setup. Now user needs to execute net-setup.sh script from
net-tools project to setup host ethernet interface. The script
needs to be run as a root user. Then zephyr.exe can be started
as a normal user.

Example:
    cd net-tools
    sudo ./net-setup.sh

This will create zeth network interface and set IP address and
routes properly. See other command line options by typing
    ./net-setup.sh --help

Old behaviour is still there if one enables
    CONFIG_ETH_NATIVE_POSIX_STARTUP_AUTOMATIC=y

in which case one needs to use the command
    sudo --preserve-env zephyr.exe

to start the Zephyr process.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-23 11:08:39 +03:00
Daniel Leung fb50cac6b8 audio: tlv320dac310x.c:141: fix too few arguments for format
The logging statement specifies a parameter but one was never
provided. So add it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-10-19 17:52:45 -04:00
Andrei Gansari 02e217df50 drivers: eth_mcux: kinetis networking device Tree
Partially replaces Kinetis MCUX driver configuration from Kconfig to
Device Tree. Interrputs moved from defines configuration to DT.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2018-10-19 07:57:20 -05:00
Johan Hedberg 251d99132d Bluetooth: Remove custom stack macros
Now that log processing happens in a separate thread, the
BT_STACK_EXTRA macro is not needed (since there's no significant
overhead), and therefore the BT_STACK macros become unnecessary as
well.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-10-19 14:50:22 +02:00
Johan Hedberg 343c53e841 Bluetooth: Switch from SYS_LOG to logger-based logging
Initial conversion to use syslog instead of logger.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-10-19 14:50:22 +02:00
Jakub Rzeszutko 147122e77f shell: examples unification
Updating examples according to new return value of function
shell_cmd_precheck.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-19 13:35:56 +02:00
Jakub Rzeszutko a794e3981e drivers: serial: nrfx: fix spelling mistake in an error message
Preprocesor error message was changed from UARTE0 to UARTE1
for instance 1 of UARTE.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-19 12:03:40 +02:00
Anas Nashif 3aa2a1c6db flash: make flash shell generic
This shell command was tied to bluetooth and the bluetooth shell and
also had messages all related to nordic ICs.
Make it generic and put it under drivers/flash/ so it can be included by
anyone and independently of bluetooth.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-19 11:49:18 +02:00
Anas Nashif 8eff21a8dd drivers: gpio: add shell for controlling GPIO
Provide basic commands for configuring/setting/reading GPIO ports.

> gpio conf ..
> gpio set ..
> gpio get ..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-18 10:15:50 -04:00
Johann Fischer 38765d2c40 drivers: fxos8700: mention compatible devices in the help section
Mention compatible devices in the Kconfig help section.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer ba4239f5f8 Revert "drivers: sensor: Add support for MMA8451Q (3-axis accelerometer)"
Driver fxos8700 can also be used for the MMA8451
accelerometer and offers more functionality.
Revert the commit to avoid duplicate code.

This reverts commit 9c0d7813e5.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer 47bb0e1e5f drivers: fxos8700: add verification of the supported devices
Add basic verification of the supported devices.
Add IDs for MMA8451, MMA8652, MMA8653 and FXOS8700 and
remove Kconfig FXOS8700_WHOAMI option.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer b401f5ee38 drivers: fxos8700: add motion detection
Add basic support for motion detection.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer 8e0ec542a5 drivers: fxos8700: add power mode configuration
Add power mode configuration.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Johann Fischer 6bd80cdc97 drivers: fxos8700: allow to change output data rate
Add attr_set for SENSOR_ATTR_SAMPLING_FREQUENCY and
allow to change output data rate.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-17 14:16:02 -05:00
Pawel Dunaj 004b8b26c0 drivers: sensors: qdec_nrfx: Add support for Nordic QDEC
Add a QDEC driver that utilizes Nordic's QDEC.

This closes issue #9364

Jira:DESK-259

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2018-10-17 13:45:51 -05:00
qianfan Zhao 94fa5ca91b drivers: gpio_sam: fix gpio_sam_write ACCESS_BY_PORT mode
The 'value' param in ACCESS_BY_PORT mode means the state of a port,
one bit represented one pin in param 'value'.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-17 08:03:38 -04:00
qianfan Zhao ccab779b48 drivers: gpio_sam: Add ACCESS_BY_PORT mode for gpio config
ACCESS_BY_PORT mode can configure all the pins the same way in the port.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-17 08:03:38 -04:00
Galen Seitz f5c146dad9 drivers: pinmux: stm32: Add support for STM32F302x8
Add pin muxing for STM32F302x8 by sharing most of the definitions
of the STM32F303xC.  Add USART3 for both the 302x8 and the 303xC.
Add a PWM that is specific to the 302x8.

Signed-off-by: Galen Seitz <galens@seitzassoc.com>
2018-10-16 22:52:07 -04:00
Galen Seitz 8888aa9e29 drivers: interrupt_controller: Add STM32F302x8 EXTI_LINES
Define EXT_LINES for the STM32F302x8.

Signed-off-by: Galen Seitz <galens@seitzassoc.com>
2018-10-16 22:52:07 -04:00
Anas Nashif 7147f0ceeb drivers: ieee802154_cc2520: move to new logger
Move to new logger and remove commented logger calls.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 17:30:09 -04:00
Anas Nashif 80ced11209 drivers: usb_dc_nrfx: move to new logger
Move to new logger and apply style guidelines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 17:30:09 -04:00
Anas Nashif 86ad1bd03d drivers: lsm303dlhc_magn: move to new logger
Move to new logger replacing macros and defining module.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 17:30:09 -04:00
Anas Nashif b49e26680d drivers: lsm303dlhc_accel: move to new logger
Move to new logger replacing macros and defining module.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 17:30:09 -04:00
Anas Nashif 1232b44515 drivers: grove: move to new logger
Move drivers to the new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 17:30:09 -04:00
Diego Sueiro 0c7a28c4cc drivers: serial: Rework Silabs Gecko UART Driver
Introduces the location property and adds the ability to use values
generated by the device tree configuration.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-16 15:59:37 -05:00
Diego Sueiro eb20984143 drivers: Add more uart instances for Silabs Devices
Add more uart/usart instances for Silabs Gecko Devices and remove
the *_GPIO_LOC configs.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-10-16 15:59:37 -05:00
Jun Li 4982fa9858 dma: use user data in callback
Use user data to replace DMA's device pointer in
the callback function so that the user can retrieve
its context by that private data.

Signed-off-by: Jun Li <jun.r.li@intel.com>
2018-10-16 16:58:19 -04:00
Andy Ross cfe62038d2 kernel: Checkpatch fixups
I was pretty careful, but these snuck in.  Most of them are due to
overbroad string replacements in comments.  The pull request is very
large, and I'm too lazy to find exactly where to back-merge all of
these.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 987c0e5fc1 kernel: New timeout implementation
Now that the API has been fixed up, replace the existing timeout queue
with a much smaller version.  The basic algorithm is unchanged:
timeouts are stored in a sorted dlist with each node nolding a delta
time from the previous node in the list; the announce call just walks
this list pulling off the heads as needed.  Advantages:

* Properly spinlocked and SMP-aware.  The earlier timer implementation
  relied on only CPU 0 doing timeout work, and on an irq_lock() being
  taken before entry (something that was violated in a few spots).
  Now any CPU can wake up for an event (or all of them) and everything
  works correctly.

* The *_thread_timeout() API is now expressible as a clean wrapping
  (just one liners) around the lower-level interface based on function
  pointer callbacks.  As a result the timeout objects no longer need
  to store backpointers to the thread and wait_q and have shrunk by
  33%.

* MUCH smaller, to the tune of hundreds of lines of code removed.

* Future proof, in that all operations on the queue are now fronted by
  just two entry points (_add_timeout() and z_clock_announce()) which
  can easily be augmented with fancier data structures.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 96013b0375 system_timer.h: Change "now" uptime API to be simpler for drivers
The current z_clock_uptime() call (recently renamed from
_get_elapsed_program_time) requires the driver to track a full 64 bit
uptime value in ticks, which is entirely separate from the one the
kernel is already keeping.

Don't do that.  Just ask the drivers to track uptime since the last
call to z_clock_announce(), since that is going to map better to
built-in hardware capability.

Obviously existing drivers already have this feature, so they're
actually getting slightly larger in order to implement the new API in
terms of the old one.  But future drivers will thank us.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross bf531ac4fc drivers/timer: Add default z_clock_set_timeout() fallback
Useful for tick-only drivers like Pulpino that don't support this.
Ideally we'd have a header-level interface definition for individual
timer drivers to eliminate the noop function call, but this is clean
for now (even the Pulpino hardware looks like it should support
timeouts just fine, so effort would be better spent there than on a
clean "ticked" interface).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 722a888ef7 timer: Clean up hairy tickless APIs
The tickless driver had a bunch of "hairy" APIs which forced the timer
drivers to do needless low-level accounting for the benefit of the
kernel, all of which then proceeded to implement them via cut and
paste.  Specifically the "program_time" calls forced the driver to
expose to the kernel exactly when the next interrupt was due and how
much time had elapsed, in a parallel API to the existing "what time is
it" and "announce a tick" interrupts that carry the same information.

Remove these from the kernel, replacing them with synthesized logic
written in terms of the simpler APIs.

In some cases there will be a performance impact due to the use of the
64 bit uptime call, but that will go away soon.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 1a1a9539ea include/system_timer.h: Timer API cleanup
Rename timer driver API functions to be consistent.  ADD DOCS TO THE
HEADER so implementations understand what the requirements are.
Remove some unused functions that don't need declarations here.

Also removes the per-platform #if's around the power control callback
in favor of a weak-linked noop function in the driver initialization
(adds a few bytes of code to default platforms -- we'll live, I
think).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross ab488277bc drivers/timer: Unify timeout setting APIs
The existing API had two almost identical functions: _set_time() and
_timer_idle_enter().  Both simply instruct the timer driver to set the
next timer interrupt expiration appropriately so that the call to
z_clock_announce() will be made at the requested number of ticks.  On
most/all hardware, these should be implementable identically.

Unfortunately because they are specified differently, existing drivers
have implemented them in parallel.

Specify a new, unified, z_clock_set_timeout().  Document it clearly
for implementors.  And provide a shim layer for legacy drivers that
will continue to use the old functions.

Note that this patch fixes an existing bug found by inspection: the
old call to _set_time() out of z_clock_announce() failed to test for
the "wait forever" case in the situation where clock_always_on is
true, meaning that a system that reached this point and then never set
another timeout would freeze its uptime clock incorrectly.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross fa99ad66d0 sys_clock: Fix up tick announce API
There were three separate "announce ticks" entry points exposed for
use by drivers.  Unify them to just a single z_clock_announce()
function, making the "final" tick announcement the business of the
driver only, not the kernel.

Note the oddness with "_sys_idle_elapsed_ticks": this was a global
variable exposed by the kernel.  But it was never actually used by the
kernel.  It was updated and inspected only within the timer drivers,
and only so that it could be passed back to the kernel as the default
(actually hidden) argument to the announce function.  Break this false
dependency by putting this variable into each timer driver
individually.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 317178b88f sys_clock: Fix unsafe tick count usage
The system tick count is a 64 bit quantity that gets updated from
interrupt context, meaning that it's dangerously non-atomic and has to
be locked.  The core kernel clock code did this right.

But the value was also exposed to the rest of the universe as a global
variable, and virtually nothing else was doing this correctly.  Even
in the timer ISRs themselves, the interrupts may be themselves
preempted (most of our architectures support nested interrupts) by
code that wants to set timeouts and inspect system uptime.

Define a z_tick_{get,set}() API, eliminate the old variable, and make
sure everyone uses the right mechanism.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross b2e4283555 sys_clock: Make sys_clock_hw_cycles_per_tick() a proper API
This was another "global variable" API.  Give it function syntax too.
Also add a warning, because on nRF devices (at least) the cycle clock
runs in kHz and is too slow to give a precise answer here.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross cbb77be675 sys_clock.h: Remove sys_clock_ticks_per_sec()
This just got turned into a function from a "variable" API, but
post-the-most-recent-patch it turns out to be degenerate anyway.
Everyone everywhere should always have been using the kconfig variable
directly, and it was only a weirdness in the tickless API that made it
confusing.  Fix.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 220d4f8347 sys_clock.h: Make "global variable" APIs into proper functions
The existing API defined sys_clock_{hw_cycles,ticks}_per_sec as simple
"variables" to be shared, except that they were only real storage in
certain modes (the HPET driver, basically) and everywhere else they
were a build constant.

Properly, these should be an API defined by the timer driver (who
controls those rates) and consumed by the clock subsystem.  So give
them function syntax as a stepping stone to get there.

Note that this also removes the deprecated variable
_sys_clock_us_per_tick rather than give it the same treatment.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
qianfan Zhao ae363e54ec drivers: spi_sam: Config chip select pin when driver init
Configure spi chip select based on pinmap defines, add support
for hardware chip select control support.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-16 14:01:29 -05:00
qianfan Zhao 29d9004a01 drivers: spi_sam: fix spi peripheral chip select config
Should convent slave->config to SPI_MR.PCS

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-16 14:01:29 -05:00
qianfan Zhao 1eec4bbf30 drivers: spi_sam: fix compiler waring
Fix: warning: assignment discards ‘const’ qualifier from
pointer target type

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-16 14:01:29 -05:00
Johann Fischer 3a66b86544 drivers: add SSD1673 EPD controller driver
Add SSD1673 electrophoretic display controller driver.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-16 14:54:47 -04:00
Johann Fischer 419f4b7801 drivers: add SSD1306 display controller driver
Add SSD1306 OLED display controller driver.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-10-16 14:54:47 -04:00
Sebastian Bøe 1422a20093 drivers: wifi: Don't include ti/drivers/net/wifi/bsd from simplelink
Adding 'bsd' to the include path causes problems when gnuarmemb is
used. The wrong errno.h will be used in the build, causing unresolved
references to ENOTSUP.

See PR #10554 for more details.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-10-16 12:11:48 -05:00
Anas Nashif 1f6122e268 sensors: lis2dh: move header after log module init
Allow logging in header file using the module of the file including the
header.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 08:49:53 -04:00
Punit Vara e5620a2b87 drivers: sensor: Migrate to new logger
Move all sensor drivers and samples to new logging system.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-10-16 08:49:53 -04:00
Armando Visconti 86e69ddd8b drivers/i2s_ll_stm32.c: move to new logger
Move to new logger.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-10-16 08:24:45 -04:00
Nathaniel Graff c0a680166d drivers: gpio: sifive: Fix GPIO extern interrupts
IRQ_CONNECT calls in the SiFive GPIO driver were misconfigured when the
conversion to DeviceTree support occurred.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2018-10-15 21:39:21 -04:00
Philémon Jaermann 43bc39e140 drivers: sensor: lsm303dlhc magnetometer driver
Enable magnetometer measurement

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
2018-10-15 12:47:13 -05:00
Philémon Jaermann 0453b2e0dd drivers: sensor: lsm303dlhc accel driver
Enable acceleration measurement.

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
2018-10-15 12:47:13 -05:00
Christian Taedcke 8d1143c838 drivers: ethernet: stm32: Fix typo in comment
Fix minor typo in code comment.

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2018-10-15 12:01:22 -05:00
Marti Bolivar 7439367b2e drivers: led_strip: add ws2812 defaults for nRF5 devices
Define a SPI baud rate, as well as WS2812_STRIP_ONE_FRAME and
WS2812_STRIP_ZERO_FRAME values, that work for nRF5 devices.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-10-15 17:50:16 +02:00
Marti Bolivar 7cf2ce6751 drivers: led_strip: guard SPI defaults on stm32f4x kconfig
The given defaults were chosen for 96b_carbon, which is an STM32F4X
board that supports the specified WS2812_STRIP_SPI_BAUD_RATE exactly.

Rather than assume the rest of the world works that way, guard the
Kconfig options accordingly.

This is preparation work for adding configuration for other hardware.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-10-15 17:50:16 +02:00
Marti Bolivar bdde886ed5 led_strip: ws2812: HACK: memory-hungry pulse timing bugfix
At least on nRF52 devices, we are taking too much time between pixels
dealing with overhead inside the SPI driver transceive calls. This is
leading to dropped frames, because the dead time between frames is
long enough (5000ns+) to look like a reset pulse to the LED strip.

Given this SPI driver limitation, it seems this LED driver's design
decision to rely on SPI peripherals as efficient pulse generators
doesn't work well in practice.

The right way to handle this is probably to switch from SPI to
efficient inline assembly which bit-bangs the pulses with interrupts
disabled.

This is what other efficient libraries do to drive this type of
LED (e.g. FastLED uses C++ templates that expand into such
assembly). The Zephyr GPIO API doesn't support doing that in a
portable fashion, unfortunately.

For now, we'll cheat by pre-allocating enough buffer space to send the
entire strip's worth of data.

This is preposterously inefficient (8x memory overhead since there's
one byte to make a SPI frame for each bit of color), but makes the
driver work correctly.

(Note that using timer peripherals as pulse generators, when combined
with DMA for efficiency, would also lead to similar levels of
overhead.)

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-10-15 17:50:16 +02:00
Jukka Rissanen ce8035e280 drivers: eth: e1000: Remove unused variable
The probe function had unused variable which caused compile warning.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-15 10:53:53 -04:00
Anas Nashif 7b46ea2be9 drivers: clock_control_mcux: register logging module
Add missing registration for log module.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-15 10:48:11 -04:00
Anas Nashif 5c76143bcd drivers: modem: register logging module
Add missing registration for modem driver.

Fixes #10518

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-15 10:48:11 -04:00
Alberto Escolar Piedras 08fdccbb8e drivers: entropy nRF5x : use new compatible SOC symbol
Depend on the new SOC_COMPATIBLE_NRF symbol instead of the
SOC_FAMILY_NRF symbol.

This allows the driver to be used from the bsim simulated board

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-15 09:36:37 -04:00
Alberto Escolar Piedras 10bd2e6eef drivers: timer nRF: use new BabbleSim config option
The simulator symbol was renamed.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-15 09:36:37 -04:00
Alberto Escolar Piedras 30fbf56a7a drivers: timer nRF: simplify kconfig depend
Simplify the Kconfig dependency for the nrf timer driver.
CLOCK_CONTROL_NRF5 depends on the SOC_FAMILY_NRF already.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-15 09:36:37 -04:00
Alberto Escolar Piedras cba2f29822 clock_control: nRF5x: use new compatible SOC symbol
Depend on the new SOC_COMPATIBLE_NRF symbol instead of the
SOC_FAMILY_NRF symbol.

This allows the driver to be used from the bsim simulated board

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-15 09:36:37 -04:00
Savinay Dharmappa bf389e0853 drivers: watchdog: Add dts support for QMSI based watchdog.
patch adds the device binding for qmsi watchdog and device node
for socs which are using wdt qmsi driver.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-14 14:16:03 -04:00
Savinay Dharmappa 7b6776a36a drivers: wdt: Migrate esp32 wdt driver api to new wdt interface
patch migrates the esp32 wdt driver to new wdt interfaces

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-10-14 14:16:03 -04:00
Savinay Dharmappa ea07658a4f drivers: wdt: Migrate qmsi wdt driver api to new wdt api interface.
patch migrates the wdt qmsi driver to new wdt interfaces.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-10-14 14:16:03 -04:00
Kumar Gala e46b9c0e49 rtc: rtc_mcux: Fix build issue with logging change
When the driver was changed to use the new logging subsystem, it used
LOG_DOMAIN_REGISTER should have been LOG_MODULE_REGISTER.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-13 10:41:50 -04:00
Jan Van Winkel db9403def5 drivers: sensors: Added MS5837 driver
Added MS5837 pressure sensor driver

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-10-12 14:28:32 -05:00
Mario Tesi 5d8834bee4 driver: sensor: Add support for LIS2MDL Mag sensor
Added support to LIS2MDL Magnetometer sensor provided
with following features:
	- I2C interface
	- Mag data
	- Temperature data
	- ODR configurable by config or at runtime
	- Trigger mode selectable by menuconfig
	- IRQ pin configurable (by dts or Kconfig)
	- Hard Iron offset setting at runtime
	- Include yaml file

Tested on ST MEMS IKS01A2 + NUCLEO STM32F411RE board.
LIS2MDL connected to I2C master interface (SPI 3 wire not
supported yet).
Test run with all ODR {10, 20, 50, 100} Hz in poll and
trigger mode.

GPIO IRQ dts configuration has been tested by adding
to boards/arm/nucleo_f411re/nucleo_f411re.dts file
this patch:

&i2c1 {
        status = "ok";
        clock-frequency = <I2C_BITRATE_FAST>;
+
+       /* ST Microelectronics LIS2MDL mag sensor */
+       lis2mdl-magn@1e {
+               compatible = "st,lis2mdl-magn";
+               reg = <0x1e>;
+               irq-gpios = <&gpioa 4 0>;
+               label = "LIS2MDL";
+               status = "ok";
+       };
};

and adding boards/arm/nucleo_f411re/dts.fixup with following
content:

	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_LABEL
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_BASE_ADDRESS
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_BUS_NAME
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_IRQ_GPIOS_CONTROLLER
	ST_STM32_I2C_V1_40005400_ST_LIS2MDL_MAGN_1E_IRQ_GPIOS_PIN

For more info on this LIS2MDL please follow this link:
http://www.st.com/en/mems-and-sensors/lis2mdl.html

Signed-off-by: Mario Tesi <mario.tesi@st.com>
2018-10-12 14:13:50 -05:00
Paul Sokolovsky 1a1df5824c drivers: pci: pci_show: Add missing space in output
Previously, it printed a line like:

0:2 8086:100e class: 0x2, 0, 0, MEM,addrs: 0xfebc0000-0xfebdffff, IRQ 11

There's visibly a missing space in "MEM,addrs", this patch adds it.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-10-12 11:05:59 -04:00
Paul Sokolovsky 87e4dc33b6 driver: ethernet: e1000: Use correct return for device init()
In case of successful detection, return 0. Otherwise, return -ENODEV
error.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-10-12 10:26:42 -04:00
Rajavardhan Gundi b5eb656142 drivers: dma_cavs: Correct typo for logger
LOG_MODULE_REGISTEr corrected to LOG_MODULE_REGISTER.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-10-12 07:52:17 -04:00
Paweł Zadrożniak 68cb7b3e38 drivers: usb: Add nRF52840 USBD driver
* Add usbd_dc_nrfx shim

The shim is based on the previous one usbd_dc_nrf5.
For handling the USBD hardware, tested nrfx_usbd driver from nRF SDK
was used.

Briefly tested examples:
* usb/cdc_acm
* usb/dfu (USB communication only due to flash handling issues)
* usb/hid-mouse
* bluetooth/hci_usb

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2018-10-12 13:14:12 +02:00
qianfan Zhao 7f92deb641 drivers: usart_sam: fix usart2 device config informations
1. fix typo: PORT_3_PERIPHERAL_ID -> PORT_2_PERIPHERAL_ID
2. add missing irq_config_func

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-12 06:07:21 -05:00
Gil Pitney 1022b85c0f drivers: wifi: simplelink: Implement offloaded getaddrinfo()
This offloads the getaddrinfo() socket operation to the
simplelink WiFi driver, via a socket_offload hook.

This was validated using http_get on cc3220sf_launchxl.

Also implements freeaddrinfo().

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-12 13:06:53 +03:00
Armando Visconti 7b82e9f2d0 drivers: i2s: Add support for I2S stm32
STM32 I2S driver implementation. It has been designed in the most
generic way possible, with the possibility of using it in master/slave
and rx/tx mode. Currenty it has been tested for master rx mode only
using the microphone on ArgonKey board.

The configuration file permits to compile it for STM32F4xx product
family only, but it should be easy to extend it also for other
families.

It supports all 5 STM32F4xx I2S controllers (I2S 1/4/5 on APB2 and
I2S 2/3 on APB1).
It makes uses of the available DMA channels for rx/tx streams.

The clock source can be selected among one of the following two choices:

  - PLLI2S pll, with possibility to configure PLLM/PLLN/PLLR
  - HSE/HSI clock

Interrupt is triggered only in case of errors (FRM/OVR/UDR).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-10-11 16:55:00 +02:00
Gil Pitney 0633a1c294 drivers: wifi: simplelink: More fixes after logging update
Previously, '\n' in LOG_DBG statements were added to
improve readability, by ensuring IP address weren't printed
across typical console terminal line boundaries.

But with the logging updates, '\n' is no longer
getting automatically expanded to \r\n, and a new timestamp
is automatically added, throwing off attempts at alignment.

This patch finally just removes the '\n''s from the log messages,
and cuts a few longer messages into separate messages.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-11 15:51:57 +03:00
Gil Pitney c2cdbbafd7 net: sockets: Get socket offload to build after net logging overhaul.
Also, defines one LOG_MODULE_NAME for the simplelink WiFi driver, and
uses the same name for all files in this driver (module).

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-11 15:51:57 +03:00
Gil Pitney 7520bb21bc drivers: wifi: simplelink: Move NWP configuration to iface_init
Previously, the NWP (Network Coprocessor) was configured during
simplelink_init().

Since the SimpleLink "FastConnect" feature was added,
meaning an automatic reconnect can occur at this time, this
results in early callbacks into the network stack
before it was fully initialized, resulting in a NULL iface
ptr being sent in as argument.

Now, for safety, the NWP startup is moved later to iface_init,
where it more logically belongs.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-11 14:32:48 +03:00
Anas Nashif 518ec097eb drivers: soc_flash_nios2_qspi: fix logging formatting
Fix formatting in logging messages. Remove newline.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 15:46:52 -04:00
Yannis Damigos c9007f0daf drivers: usb_dc_stm32: Add HIGH and HIGH_IN_FULL defines for L4 series
STM32L4 series USB LL API doesn't provide HIGH and HIGH_IN_FULL speed.
Define them on drivers level.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-10-10 12:27:55 -05:00
Anas Nashif 44f0a79dbb drivers: i2c: enable logging for drivers loading i2c-priv.h
i2c-priv.h is currently doing some logging and is included in various
i2c drivers, make sure the logger is enabled for those drivers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 13:26:58 -04:00
Marcio Montenegro 53a86f0a33 drivers: serial: Adapt gecko uart driver for Silabs EFM32HG
Happy Gecko has 2 USART not UART and also supports more pin locations.

Signed-off-by: Marcio Montenegro <mtuxpe@gmail.com>
Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2018-10-10 12:00:06 -05:00
qianfan Zhao 6e4963b978 drivers: add spi support for atmel sam series soc
This driver is based on spi_sam0

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-10 11:29:49 -05:00
Anas Nashif ecc050e69e drivers: modem: move to new logger
Move driver to new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif c1d2930471 drivers: wifi: move to new logger
Move drivers to new logger and change samples enabling logging in
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif 9eeff22957 drivers: rtc: move to new logger
Move drivers to new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif ef46d11098 drivers: led_strip: move to new logger
Move drivers to new logger and change samples enabling logging in
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif ffb75da2ea drivers: flash: move to new logger
Move drivers to new logger and change samples enabling logging in
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif 6b8bbc7d07 drivers: flash: fix Kconfig dependencies
Use top level conditional and remove 'depends on FLASH'

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif 49838296f8 drivers: dma: fix logger call
We had one stray SYS_LOG.. in the file that was added after initial move
was done.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif 7e61660c9c driver: led: move to new logger
Move drivers to new logger and change samples enabling logging in
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif 0a04a134a8 drivers: i2s_sam_ssc: fix syntax using uncrustify
After changing the logger, run uncrustify to update syntax.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif a5ae1af615 drivers: i2s_cavs: fix syntax using uncrustify
After changing the logger, run uncrustify to update syntax.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif a66967b0f2 driver: i2s: move to new logger
Move drivers to new logger and change samples enabling logging in
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Oleg Zhurakivskyy 65ea181c92 drivers: eth: e1000: Add driver for Intel PRO/1000 Ethernet controller
This patch adds a driver for Intel PRO/1000 Gigabit Ethernet controller.

The driver currently supports only a single instance of the NIC.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-10-10 04:17:15 -04:00
Kumar Gala c3076d6eb2 gpio: silabs gecko: Add device tree support for GPIO
Convert gpio_gecko driver over to using device tree. Added binding
files, updates to dts for various SoCs that use gpio_gecko.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-09 22:34:56 -04:00
Alberto Escolar Piedras ba4a01e8ff drivers: timer: native_posix: Support SYSTEM_CLOCK_DISABLE
Add support for CONFIG_SYSTEM_CLOCK_DISABLE so applications
may be compiled with CONFIG_REBOOT.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-09 16:15:45 -04:00
Carles Cufi 4fe661181c drivers: usb: stm32: Limit the amount of bytes to write
Limit the amount of bytes to write to EP0 to 64 bytes so that there is
no overflow or error when sending.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-10-09 21:37:51 +02:00
Ioannis Glaropoulos ce4e00db65 drivers: serial: nrf: remove obsolete PIN Kconfig definitions
This commit removes the Kconfig symbol definitions
that signify the UARTE_1 pins. The symbols are
already removed for UARTE_0.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-10-09 14:51:03 -04:00
Krzysztof Chruscinski ff5f00f2c3 lib: ring_buffer: Rename sys_ring_buf_ to ring_buf_item_
Deprecate API prefixed with sys_ring_buf_ and rename it
to ring_buf_item_ since this API is not a typical ring buffer
but ring buffer of data items (metadata + 32bit words).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-09 13:58:44 -04:00
Yannis Damigos 3c9f1c9627 drivers: usb_dc_stm32: Get maximum-speed from DT
Get maximum-speed from device tree for OTG FS/HS.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-10-09 12:59:34 -04:00
Armando Visconti 92ed716169 drivers: dma: stm32f4: Fix typo introduced with new logger
Compilation of this driver was broken by commit 07ff2d5
as reported in issue #10453. This commit is fixing it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-10-09 13:29:08 +02:00
Anas Nashif 5aef010a49 websocket_console: fix syntax
Fix layout and syntax with uncrustify after changing to new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 6ac79df1e1 telnet_console: fix syntax
Fix layout and syntax with uncrustify after changing to new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif a70e28e9e2 console: move to new logger
Use new logger and remove usage of SYS_LOG.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif c2551ea57b gpio: log: rename level variable
Rename log level variable:
 CONFIG_LOG_GPIO_LEVEL to CONFIG_GPIO_LOG_LEVEL

Use template for log levels.

Register modules in drivers using logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif ab3f56577f gpio_sch: fix log message
log message missing a parameter for the pin.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Olivier Martin 9339d65e6e drivers: gpio: Migrate to new logging subsys
Migrate from `SYS_LOG` to `LOG` logging mechanism.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-10-08 17:49:12 -04:00
Anas Nashif 68958b35a1 drivers: display: define DISPLAY log level
Use a common log level for display drivers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif f4fb215148 drivers: spi_dw: remove debug message
Remove debug message using undefined functions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 88aa2ca49f driver: spi: use new logger
move SPI drivers to use new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif ff9c20826c driver: pwm: use new logger
move PWM driver to use new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Olivier Martin 049a4f8688 drivers: watchdog: Migrate to new logging subsys
Migrate from `SYS_LOG` to `LOG` logging mechanism.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 07ff2d580b drivers: dma: move to new logger
Move to new logger and adapt samples.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif f7dac85d15 drivers: i2c: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 3da714193f drivers: crypto: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 4faa6993f1 drivers: clock_control: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif c141df09e3 drivers: can: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 31a089412f drivers: audio: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 9a8567fa4a drivers: adc: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif d77e6cc5cf drivers: entropy: remove unused logger kconfig
This is not being used by any drivers, so removing until we need it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Yannis Damigos 452c3d6a87 include/usb/usb_device: Add USB_* log macros
Add USB_DBG, USB_WRN, USB_ERR, USB_INF macros
in usb_device header file and remove them
from usb device drivers.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-10-08 12:54:57 -04:00
Yannis Damigos 1674d061b6 drivers: usb: device: Migrate to new logger
Move to new logger subsystem.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-10-08 12:54:57 -04:00
Pushpal Sidhu 5bc5bb2c7f flash: stm32l4x: Correct getting page number from STM32L4R/S devices
These devices increase the page size from 2k (standard STM32L4) to 4K,
so we must account for this.

Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
2018-10-08 12:52:00 -04:00
Alexander Polleti c8153c35fe dma: check whether memory to memory is allowed
This patch checks whether memory to memory is allowed for the device.
Tested it with tests/drivers/dma with one of the 2 settings:
CONFIG_DMA1_NAME=DMA_0 -> test fails with error message on console
	and an error at configuration.
CONFIG_DMA2_NAME=DMA_0 -> test succeeds
Fixes: #7547

Signed-off-by: Alexander Polleti <metapsycholo@gmail.com>
2018-10-08 12:47:49 -04:00
Kumar Gala 5a24afadb8 drivers: serial: uart_sifive: Get clock frequency from device tree
Move to getting the clock frequency of the uart from the device tree
instead of a define in the board file.  Cleaned up hifive1 board code to
reflect this change in addition to the driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-05 13:21:49 -05:00
Kumar Gala da7ac50683 gpio: sifive: Add device tree support for GPIO generation
Add the missing bits to the yaml, dts, and Kconfig to enable GPIO pin
generation based on device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-05 13:21:49 -05:00
Erwan Gouriou 85742e3c9a drivers/spi: stm32: fix warning in SYS_LOG_ERR macro
Following log subsystem rework, a warning poped-up in SYS_LOG_ERR
in spi_stm32_get_err macro.
Fix it by casting SPI_STM32_ERR_MSK on (u32_t)

Fixes #10380

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-10-05 11:11:03 -04:00
Jukka Rissanen 69eeddd8a9 drivers: wifi: Convert to use new logging
Convert the wifi drivers to use the new logging system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-05 10:08:32 -04:00
Jukka Rissanen 009e4dafa7 net: Make Kconfig template variables prettier
Adding spaces around "=" when definining Kconfig template so
that is more consistent with overall style of these template
variables.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-05 09:01:37 -04:00
Kumar Gala db2ca70a23 dts: pulpino: Add device tree support for GPIO controller
Add the needed bits to get device tree support for the GPIO controller
on the Zedboard-Pulpino.  This will allow us to move LED & button info
into the board.dts.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-04 07:48:32 -05:00
Gil Pitney be64964f1e driver: wifi: simplelink: Fix socket offload after s_addr cleanup
The commit 8592501828
("net: Remove s_addr/s6_addr defines from in_addr/in6_addr")

did a (welcomed) removal of a #define s_addr for which the SimpleLink
SDK was checking, breaking the socket_offload driver build.

This patch fixes the driver to work with this new, better
s_addr symbol definition.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-04 07:42:12 -05:00
Jukka Rissanen d671c4693c drivers: net: loopback: Convert to use new logging
Convert the driver to use the new logging system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-04 14:13:57 +03:00
Jukka Rissanen 1fea1418de drivers: net: slip: Convert to use new logging
Convert the driver to use the new logging system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-04 14:13:57 +03:00
Jukka Rissanen 90dc38f8c9 drivers: ieee802154: Convert to use new logging
Convert the IEEE 802.15.4 drivers to use the new logging system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-04 14:13:57 +03:00
Jukka Rissanen 20295c821b drivers: eth: Convert to use new logging
Convert the ethernet drivers to use the new logging system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-04 14:13:57 +03:00
Jan Van Winkel d332ae5b6a driver: Updated ILI9340 driver to use display API
Updated ILI9340 display driver and sample application to make use off
the display API

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-10-03 11:29:00 -07:00
Jan Van Winkel 3dc2e733e8 drivers: display: Migrate to new logging subsystem
Migrate from SYS_LOG to LOG logging mechanism.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-10-03 11:29:00 -07:00
Kumar Gala 58ec6fd30f gpio: remove unused GPIO_INT_CLOCK_SYNC flag
GPIO_INT_CLOCK_SYNC wasn't implemented by anything, so remove it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-03 08:23:24 -05:00
Aurelien Jarno 42b6a2dd09 drivers: pinmux: stm32f7: add PWM pinmux entries
This patch adds the PWM pinmux entries for the STM32F7 series.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-10-02 14:08:00 -07:00
Aurelien Jarno f74d285a43 drivers: pinmux: stm32f7: tidy up entries
Group the entries by pin number and then sort them by alternate
function. This helps when editing the file.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-10-02 14:08:00 -07:00
Maureen Helm 98d765a3b4 drivers: sensor: Remove Kconfigs conditioned upon !HAS_DTS_GPIO
Make device tree required for these sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-02 10:50:18 -07:00
Maureen Helm bd6facbc14 drivers: sensor: Remove Kconfigs conditioned upon !HAS_DTS_SPI
Make device tree required for these sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-02 10:50:18 -07:00
Maureen Helm 2b72283bda drivers: sensor: Remove Kconfigs conditioned upon !HAS_DTS_I2C
Make device tree required for these sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-02 10:50:18 -07:00
Joakim Andre Tønnesen d6e0fdca8c net: sockets: Add getaddrinfo and freeaddrinfo to socket offloading
Adds getaddrinfo and freeaddrinfo to the offloaded API.

Signed-off-by: Joakim Andre Tønnesen <joakim.tonnesen@nordicsemi.no>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-10-02 11:11:15 +03:00
Maureen Helm ad32e3b543 drivers: boards: Merge HAS_DTS_SPI_PINS with HAS_DTS_SPI
Every board that uses dts-enabled spi drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_SPI_PINS and
HAS_DTS_SPI.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Maureen Helm eeb4411de7 drivers: boards: Merge HAS_DTS_GPIO_DEVICE with HAS_DTS_GPIO
Every board that uses dts-enabled gpio drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_GPIO_DEVICE and
HAS_DTS_GPIO.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Maureen Helm 89ccead382 drivers: boards: Merge HAS_DTS_SPI_DEVICE with HAS_DTS_SPI
Every board that uses dts-enabled spi drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_SPI_DEVICE and
HAS_DTS_SPI.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Maureen Helm 75bc6ba454 drivers: boards: Merge HAS_DTS_I2C_DEVICE with HAS_DTS_I2C
Every board that uses dts-enabled i2c drivers has a board-level dts, so
there is no need to have separate configs HAS_DTS_I2C_DEVICE and
HAS_DTS_I2C.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-10-01 21:15:06 -05:00
Maureen Helm 5dc584975b drivers: gpio: Select HAS_DTS_GPIO in various drivers
Selects HAS_DTS_GPIO in various gpio drivers that already support dts,
similar to how we select HAS_DTS_SPI in spi drivers and HAS_DTS_I2C in
i2c drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-28 11:44:03 -05:00
Daniel Leung e2c590a0c4 drivers: ethernet: native: fix compile error when glibc >= 2.20
Starting with glibc 2.20, there is warning when _BSD_SOURCE is defined
but not _DEFAULT_SOURCE (in /usr/include/features.h around line 184).
Sanitycheck turns this warning into error. So define _DEFAULT_SOURCE
at build time for native.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-28 11:32:09 +03:00
Mark Ruvald Pedersen d67096da05 portability: Avoid void* arithmetics which is a GNU extension
Under GNU C, sizeof(void) = 1. This commit merely makes it explicit u8.

Pointer arithmetics over void types is:
 * A GNU C extension
 * Not supported by Clang
 * Illegal across all ISO C standards

See also: https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2018-09-28 07:57:28 +05:30
Maureen Helm 55caa7b743 drivers: spi: Select HAS_DTS_SPI in designware driver
Makes the designware spi driver consistent with other spi drivers by
selecting HAS_DTS_SPI in the driver. This required adding spi nodes and
dts fixups to several arc and x86 socs, as well as enabling those nodes
in associated boards.

Also refactors the driver to use the base address, interrupt number, and
interrupt priority from dts.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-28 06:27:06 +05:30
qianfan Zhao 15959c8b85 drivers: eth_sam: Add generate random mac address feature
Using a random mac address with Atmel's OUI if enabled this feature

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-09-27 21:52:14 +03:00
Alberto Escolar Piedras 013f279111 uart: Add driver for posix arch
Added a new UART driver for posix arch boards.
The driver can be configured to either attach to a new
pseudo-terminal, or to connect to the invoking shell
stdin-out.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-09-27 17:24:34 +02:00
Maureen Helm 00d60055fb drivers: serial: Add instances to mcux lpuart shim driver
Adds instances 2 and 3 to the mcux lpuart shim driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-27 05:55:55 +05:30
Maureen Helm 50d276f1ae drivers: i2c: Select HAS_DTS_I2C in designware and qmsi drivers
Makes the designware and qmsi i2c drivers consistent with other i2c
drivers by selecting HAS_DTS_I2C in the driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-27 05:54:54 +05:30
Alberto Escolar Piedras c065ebdfc2 drivers: ethernet: native: Fix compile issue in RedHat 7
Fix 2 compile issues in RedHat/CentOS 7 for the native
ethernet driver due to a oldish glibc, which does not include
by default the needed structures.
+
Separate the native ethernet driver into its own library,
and set NO_POSIX_CHEATS for it, in case the Zephyr POSIX
library would eventually add support for any of the host functions
used in this driver.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-09-26 13:06:08 +03:00
Mieszko Mierunski 1dd5dc63c1 drivers: i2c: Add dts support for i2c slaves.
Adding i2c slave requires overlay with node definitions and
proper aliases depending on driver implementation.

Modified i2c_slave_api test to use information from dts.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-09-24 07:26:07 -05:00
Nazar Chornenkyy edd6c7df41 drivers: serial: Add Cypress PSoC6 UART driver
Added basic PSoC6 UART driver and added two UART nodes in the PSoC6
device tree to have output from CM0+ and CM4 cores.

Signed-off-by: Nazar Chornenkyy <nazar.chornenkyy@cypress.com>
Signed-off-by: Oleg Kapshii <oleg.kapshii@cypress.com>
2018-09-21 18:50:59 -04:00
Andrzej Głąbek 7ed7d535e9 drivers: adc: nrfx: Use SAADC HAL for setting the burst mode
Replaces direct accesses to the peripheral registers structure
with the proper SAADC HAL function that appeared recently in nrfx.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-09-21 09:12:14 -07:00
Johann Fischer 59a6ec44b7 drivers: apds9960: use power management
Use power management

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Johann Fischer b192b2b575 drivers: apds9960: add trigger mode for proximity
Add trigger mode for proximity

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Johann Fischer 963f97d035 drivers: apds9960: use interrupt output for sample
This patch changes the behavior of the sensor. The sensor
will remain in sleep mode after initialization and will only
run the measurements once when sample_fetch is called.
This optimizes the power consumption of the sensor as it
stays in sleep mode most of the time.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Johann Fischer 9c3d77380a driver: apds9960: reorganize ALS and proximity setups
Refactor and reorganize ALS and proximity setup functions.
Cleanup and reorder register, fix register fields.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Johann Fischer 163629c96a drivers: apds9960: use i2c_burst_read to fetch ALS data
Use i2c_burst_read to fetch ALS data.
Use unsigned values for ALS and proximity data.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-09-21 09:02:00 -05:00
Vinayak Kariappa Chettimada 9da6a85c8c drivers: flash: nrf5: Use faster write interval with BT sync
Use a lower slot duration than the used erase slot duration
to speed up the interval of write operations when in sync
with active Bluetooth connections.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2018-09-21 13:15:54 +02:00
Adithya Baglody 36365e38ba drivers: timers: systick: Enforce a barrier in _timer_cycle_get_32.
The code assumes that when the systick counter hits zero,
the timer interrupt will be taken before the loop can
read the LOAD/VAL registers, but this is not architecturally
guaranteed, and so the code can see a post-reload SysTick->VAL
and a pre-reload clock_accumulated_count, which causes it to
return an incorrectly small cycle count. By adding a ISB we
overcome this issue.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-09-20 20:35:25 -04:00
Maureen Helm a013ce3bf0 drivers: sensor: Fix incorrect Kconfig dependency in lsm6dsl
The lsm6dsl sensor driver incorrectly conditioned the interrupt pin
Kconfigs upon !HAS_DTS_SPI_PINS, when it should actually be
!HAS_DTS_GPIO_DEVICE.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Maureen Helm 06f73456ba drivers: sensor: Fix casting warnings
Fixes casting warnings in multiple sensor drivers when creating their
own thread. These warnings were found when updating the build_all tests
to include missing sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Maureen Helm 553a31efb9 drivers: sensor: Add missing cmake files for bmm150
The bmm150 sensor driver was missed in the conversion from kbuild to
cmake. This problem was found when updating the build_all tests to
include missing sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Maureen Helm 7ac70c4764 drivers: sensor: Fix compiler format warning in bmi160
Fixes a compiler format warning in the bmi160 sensor driver. This
warning was found when updating the build_all tests to include missing
sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Maureen Helm 2875c052dc drivers: sensor: Fix unused variable warnings
Fixes unused variable warnings for the adxl362 and lis2dh sensor
drivers. These warnings were found when updating the build_all tests to
include missing sensor drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-20 12:43:59 -04:00
Daniel Leung 8d18ebde9b gpio: add driver for Intel Apollo Lake SoC
This adds a driver for GPIO controller on the Intel
Apollo Lake SoC.

Origin: Original

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-19 21:36:16 -04:00
Krzysztof Chruscinski 527256501f shell: Rename shell to legacy_shell
New shell implementation is on the way. For now old one and all
references are kept to be gradually replaced by new shell.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-09-19 09:30:29 -04:00
Aurelien Jarno 86442038e9 drivers: pinmux: add PINMUX_DEV CMakeLists.txt
The drivers/pinmux/dev directory doesn't containe any CMakeLists.txt
file, preventing to enable the PINMUX_DEV option. Fix that by providing
one.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-09-19 09:17:25 -04:00
Maureen Helm 45d3d8e441 spi: Introduce mcux lpspi shim driver
Introduces a new mcux lpspi shim driver to be used on the imxrt soc.
This shim driver leverages heavily from the mcux dspi shim driver
because the MCUXpresso SDK provides similar APIs for the lpspi and dspi
peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-19 09:15:29 -04:00
Maureen Helm 83a6781507 clock_control: Add support for lpspi clock in mcux ccm driver
Adds support for getting the lpspi clock frequency in the mcux ccm
driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-19 09:15:29 -04:00
Tomasz Gorochowik 233020650f drivers: eth: gmac: Proper ptp clock setup
Calculate proper initial PTP clock divisors based on the MCK value.

Additionally do not allow adjusting the rate of the clock. This does not
seem to work properly with current gPTP rate adjustment algorithm.

Having proper PTP clock divisors and callbacks that allow getting,
setting and adjusting current time is sufficient for proper gPTP
support.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-09-19 09:54:29 +03:00
Maureen Helm 873d63c59b drivers: i2c: Parse 10-bit addressing flag in mcux driver
Parses the new message-level flag for 10-bit addressing in the mcux i2c
driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-18 17:37:12 -04:00
Mieszko Mierunski fd04e7def2 drivers: nrf: Switched nrf i2c drivers to 10 bit address msg flag
10 bit addressing is still not supported on nrf chips, but now
I2C_MSG_ADDR_10_BITS flag is checked.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-09-18 12:06:11 -04:00
Maureen Helm 2b7840eae6 spi: Remove unused Kconfig symbols from mcux dspi driver
These mcux dspi driver configs are no longer used after legacy API
support was removed in commit 09dd5e9b22.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-17 15:58:03 -04:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Yannis Damigos 0c1725116a drivers/rtc: Enable RTC driver for STM32F3 series
Enable RTC driver for STM32F3 series.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-09-14 22:48:54 -05:00
Yannis Damigos 10c763cfbc drivers/rtc: Enable RTC driver for STM32F4 series
Enable RTC driver for STM32F4 series.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-09-14 22:48:54 -05:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Maureen Helm 95be60a80f usb: device: Fix kinetis driver to compile with SYS_LOG disabled
Fixes a compile error in the kinetis usb device driver when SYS_LOG is
disabled.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-14 13:22:03 -05:00
Rajavardhan Gundi dc45def9d0 drivers/gpio_sam: Fix incorrect flag checking
Corrected the checking for edge/level interrupts in the flags
variable.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-09-13 11:29:17 -04:00
Maureen Helm 232cb657fc sensor: Remove unnecessary Kconfig parentheses in sensor drivers
Removes Kconfig parentheses that become unnecessary after commits
7fe3a481d0 and
ab9017ec83.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-13 10:49:54 -04:00
Maureen Helm 7fe3a481d0 sensor: Remove redundant Kconfig "depends on SENSOR" in sensor drivers
The sensor driver Kconfigs are sourced inside an "if SENSOR..endif"
conditional, so it is redundant for sensor drivers to explicitly
"depends on SENSOR".

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-13 01:02:37 -04:00
Maureen Helm ab9017ec83 sensor: Eliminate repetitive Kconfig "depends on" in sensor drivers
For each sensor driver, wrap all Kconfig symbols in a big if/endif
conditional rather than repeating "depends on" for each symbol.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-09-13 01:02:37 -04:00
Paweł Zadrożniak 7c2197f2d8 boards: nrf: uart: Moved UART pin configuration to DTS (nRF boards)
UART pins (TX, RX, RTS, CTS) are now configured in DTS files.
RTS and CTS definitions are optional. If flow control is enabled
and RTS/CTS pins are not defined, then compiler will issue
an error message.

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2018-09-11 23:29:50 -05:00
Frank Li 70efac6e90 drivers: sensor: dht: Fix fetch fail when config hw cycles=32768
When config hw cycles=32768 max_wait_cycles maybe small than 60us.
The fix change the condition,make sure the wait time exceeds 80us.

Fixed #9816

Signed-off-by: Frank Li <lgl88911@163.com>
2018-09-11 18:42:47 -05:00
Andrzej Głąbek 61eb2a1c80 drivers: gpio: nrfx: Use GPIOTE HAL for checking allocated channels
Replaces direct accesses to the peripheral registers structure
with the proper GPIOTE HAL function added recently to nrfx.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-09-11 12:55:07 -04:00
Gil Pitney 71182cb294 driver: wifi: simplelink: Register socket offload operations.
If the SimpleLink WiFi driver is configured, and socket offload
enabled, this revectors the Zephyr BSD socket APIs to the SimpleLink
WiFi host driver BSD socket APIs, providing a
direct offload of the TCP/IP stack to the CC3220SF network
coprocessor.

Fixes #3706

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-09-11 18:42:34 +03:00
Filip Kubicz 990a0e8c71 dts: add SPI bindings for nRF family
This change adds DTS definition of SPI device for nRF chips.
It also removes SPI pin configuration from Kconfig and moves it to
chip DTS.

Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
2018-09-11 11:41:37 +02:00
Justin Watson bfca8b677b adc: sam: Fixed adc_api test for the SAM E70.
The interval_us is supported by the adc_context code. It is not a
feature that the driver writer needs to code to support. Fixes
bug #9723.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-09-06 13:17:29 -05:00
Daniel Leung acc40d990a adc: remove adc_qmsi driver
We now have a native driver for Quark D2000 so the QMSI
one can be removed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-05 18:38:57 -04:00
Daniel Leung 8708611fab adc: add native driver for Quark D2000
This adds a native ADC driver for Quark D2000.

Original: origin

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-05 18:38:57 -04:00
Daniel Leung ab1b61aa1e drivers: grove/light: change ADC resolution to 12-bit
The driver itself expects the ADC resolution to be 12-bit.
So set it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-05 18:38:57 -04:00
Daniel Leung af00501478 drivers: grove/temperature: ADC resolution to be 12-bit
The driver itself expects the ADC resolution to be 12-bit.
So set it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-05 18:38:57 -04:00
Anas Nashif a9f32d66cf tracing: remove stray event_logger code
Remove obsolete kernel event logger code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-09-05 16:05:08 -04:00
Vinayak Kariappa Chettimada 67786e3270 usb: device: nrf5: Fix HF clock enable check
Fixed return value check after HF clock is requested in
non-blocking mode.

hci_usb sample on nRF52840 SoC failed to enumerate USB
device on cold reset, the clock_control_on interface would
return -EINPROGRESS when clock is enabled in non-blocking
mode.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-09-05 15:26:18 +02:00
Vinayak Kariappa Chettimada 1359992d1a drivers: entropy: nrf5: Fix ENTROPY_BUSYWAIT from hanging
Missing clear pending RNG_IRQn when generating multiple
random numbers caused CPU to hang at __WFE call in the
loop waiting for new value.

This fixes commit ddb7f88f9e ("drivers: entropy: nrf5: Fix
ENTROPY_BUSYWAIT implementation")

Fixes #9523.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-09-03 12:58:40 +02:00
Frank Li 4934323931 drivers: eth: enc28j60: Fix read error when ERDPT < ERXRDPT
After read first packet and if ERDPT < ERXRDPT,cause read Rx FIFO error.
The fix is to set ERDPT properly before reading next packet.

Fixed #9537

Signed-off-by: Frank Li <lgl88911@163.com>
2018-08-31 15:46:42 -04:00
Punit Vara 003f0176a0 drivers: grove: Update temperature driver
Replace old ADC driver APIs with new ones.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Punit Vara a490a8468e drivers: grove: Modify light sensor
Replace old ADC apis with new ones.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Punit Vara b98aeab505 drivers: Kconfig.dw: Remove unnecessary Kconfig
Remove Kconfig which are replaced by dts and unnecessary macros which is
not useful anymore.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Punit Vara 353a69cbfd drivers: adc: Update new ADC APIs
Replace new ADC apis for designware driver

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Punit Vara ef83943387 drivers: Use Designware driver for sensor subsystem
Remove adc_qmsi_ss to use designware driver for sensor subsystem

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-08-29 13:46:57 -04:00
Justin Watson 4e551aabb6 sam: adc: Updated SAM ADC driver.
Updated to work with new ADC API.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-08-29 13:46:57 -04:00
Maureen Helm c0ce7d02d5 adc: Convert mcux adc16 driver to the new adc api
Major rework of the mcux adc16 driver to convert it to the new adc api.
Currently supports a subset of the api features including synchronous
and asynchronous reads, and consecutive reads triggered by the kernel
timer.

Does not yet support some of the channel configuration options such as
gain and reference voltage because the hardware only allows these
options to be configured by peripheral instance rather than by channel.
The values are currently hardcoded in the driver, but in the future we
could introduce some flexibility per instance via device tree
attributes.

Does not yet support consecutive reads triggered by a hardware timer.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-29 13:46:57 -04:00
Andrzej Głąbek 62fcfb72d2 drivers: adc: Select HAS_DTS_ADC for all ADC drivers
To require relevant DTS entries on all platforms providing the ADC
driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-29 13:46:57 -04:00
Andrzej Głąbek aad21ecb31 drivers: adc: Add shims for nrfx ADC and SAADC drivers
This commit adds translation layers to make nrfx drivers for the nRF
ADC (nRF51 series) and SAADC (nRF52 series) peripherals accessible via
the Zephyr's API. The SAADC peripheral is accessed using nrfx HAL only
as it turns out that usage of the nrfx driver in this case would be
inconvenient and would unnecessarily complicate the shim.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-29 13:46:57 -04:00
Andrzej Głąbek f1891e9473 drivers: adc: Introduce reworked API
This commit replaces the API for ADC drivers with a reworked one.
As requested in the issue #3980, the adc_enable/adc_disable functions
are removed. Additionaly, some new features are introduced, like:
- asynchronous calls
- configuration of channels
- multi-channel sampling

Common parts of code that are supposed to appear in each implementation
of the driver (like locking, synchronization, triggering of consecutive
samplings) are provided in the "adc_context.h" file to keep consistency
with the SPI driver. Syscalls are no longer present in the API because
the functions starting read requests cannot use them, since they can be
provided with a callback that is executed in the ISR context, and there
is no point in supporting syscalls only for the channels configuration.

"adc_api" test is updated and extended with additional test cases,
with intention to show how the API is supposed to be used.
"adc_simple" test is removed as it does not seem to add much value.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-29 13:46:57 -04:00
Erwan Gouriou 18b8a633b6 sensors: introduce kconfig named choices
Use Kconfig specific object "named choices".
Aim is to allow to define config choices selection in Kconfig.*
files instead of _defconfig and hence allow to keep flags
activation conditional.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-08-29 09:05:51 -04:00
Yannis Damigos 7b0632822b drivers: i2c_ll_stm32_v1: Handle NACK during address tranmsission
In polling mode, if a NACK is received during address transmission
the driver waits forever the ADDR flag. We need to check AF flag
and stop the transmission if it is set.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-08-27 12:52:53 -04:00
Yannis Damigos 32d159e335 drivers: i2c_ll_stm32_v1: Generate STOP condition if NACK
Acknowledge failure (AF) error occurs when the interface detects
a NACK bit. According to the reference manual, the transmitter
which receives a NACK must reset the communication:
– If Slave: lines are released by hardware
– If Master: a Stop or repeated Start condition must be generated
  by software

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-08-27 12:52:53 -04:00
Pawel Dunaj fb10377ecc drivers: gpio: Fix two bugs in nrfx gpio
Commit fixes two issues:
- Return correct value from gpiote_channel_alloc
- Check if pending event interrupt was not disabled

Jira:DESK-270

Fixes #9535

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2018-08-27 10:30:04 -04:00
Michael Scott 7983606327 drivers: gpio: sx1509b: Kconfig options depend on GPIO_SX1509B
When CONFIG_GPIO_SX1509B was not set, the related Kconfig options
were still showing up in .config.  Let's make them depend on
GPIO_SX1509B so they can go away when not being used.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-08-23 15:45:16 -07:00
Michael Hennerich a3e7cea1df drivers: sensors: adxl372: Add driver for ADXL372 high-g accelerometer
This patch adds support for the Analog Devices ADXL372 ultra-low power,
3-axis, +/-200 g MEMS accelerometer. The ADXL372 can be either connected
via a SPI or I2C interface.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
2018-08-21 20:19:44 -05:00
Diego Sueiro 4eee8a67f1 drivers/i2c/i2c_imx: Check for I2C bus busy before starting transaction
In some cases the minimum time between Stop and Start was not being
considered when starting a new transfer.
This patches adds a checking on the I2C Bus Busy flag before starting
a new transaction.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-08-21 18:54:41 -05:00
Anas Nashif a2248782a2 kernel: event_logger: remove kernel_event_logger
Move to more generic tracing hooks that can be implemented in different
ways and do not interfere with the kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-21 05:45:47 -07:00
Anas Nashif b6304e66f6 tracing: support generic tracing hooks
Define generic interface and hooks for tracing to replace
kernel_event_logger and existing tracing facilities with something more
common.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-21 05:45:47 -07:00
Henrik Brix Andersen 2d269bb194 drivers: pwm_nrf5_sw: Perform static initialization only once
Move static register initialization from _pin_set() to _init().

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-08-20 22:08:44 +02:00
Adithya Baglody 1d27b404a6 tests: benchmarks: timing_info: Enable benchmarks for riscv32.
This patch provides support needed to get timing related
information from riscv32 based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 79f65d4db7 tests: benchmarks: timing_info: Enable benchmarks for nios2.
This patch provides support needed to get timing related
information from nios2 based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody bb918d85f8 tests: benchmarks: timing_info: Enable benchmarks for xtensa.
This patch provides support needed to get timing related
information from xtensa based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody db0c5ca08b arch: arc: Added benchmark related hooks.
The benchmark application timing_info needs certain hooks to be
present in the kernel to get the accurate measurements. This
patch adds these hook at all the required locations.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Karol Lasończyk c9e3c938e6 tests/samples: watchdog: Update projects' configuration
WDT_NRFX is now enabling by default. Its configuration from proj.conf
files was removed.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-08-20 06:38:02 -07:00
Istvan Bisz 425aca24e5 drivers: pinmux: stm32: complete stm32l4x header
Complete and modify some USART/UART pin configurations.

Signed-off-by: Istvan Bisz <istvan.bisz@t-online.hu>
2018-08-20 05:51:52 -07:00
Istvan Bisz cc4f992b0b drivers: pinmux: stm32: complete stm32l0 header
Complete and modify some USART/UART pin configurations.

Signed-off-by: Istvan Bisz <istvan.bisz@t-online.hu>
2018-08-20 05:51:52 -07:00
Istvan Bisz 4b9388f4aa drivers: pinmux: stm32: complete stm32f7 header
Complete and modify some USART/UART pin configurations.

Signed-off-by: Istvan Bisz <istvan.bisz@t-online.hu>
2018-08-20 05:51:52 -07:00
Istvan Bisz 3fdf984ae1 drivers: pinmux: stm32: complete stm32f4 header
Complete and modify some USART/UART pin configurations.

Signed-off-by: Istvan Bisz <istvan.bisz@t-online.hu>
2018-08-20 05:51:52 -07:00
Istvan Bisz 30045e4fd2 drivers: pinmux: stm32: complete stm32f3 header
Complete and modify some USART/UART pin configurations.

Signed-off-by: Istvan Bisz <istvan.bisz@t-online.hu>
2018-08-20 05:51:52 -07:00
Istvan Bisz 0ad9b3f828 drivers: pinmux: stm32: complete stm32f0 header
Complete and modify some USART/UART pin configurations.

Signed-off-by: Istvan Bisz <istvan.bisz@t-online.hu>
2018-08-20 05:51:52 -07:00
Istvan Bisz 502d9189f0 drivers: pinmux: stm32: complete stm32f2 header
Complete and modify some USART/UART pin configurations.

Signed-off-by: Istvan Bisz <istvan.bisz@t-online.hu>
2018-08-19 11:43:25 -07:00
Sathish Kuttan e9c0f7e4e3 drivers: dma_cavs: Remove resource owner config
Remove DMA resource ownership configuration.
Such configuration will be done in an SoC level
initialization routine

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-08-19 11:06:09 -07:00
Sathish Kuttan dc88fa6aa0 drivers: i2s_cavs: Remove resource owner config
Remove I2S resource ownership configuration.
Such configuration will be done in an SoC level
initialization routine

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-08-19 11:06:09 -07:00
Sathish Kuttan 1864ba554d drivers: audio: add audio to cmake system
Add a CMakeLists.txt file for audio codec TLV320DAC
Updated drivers/CMakeLists.txt to include audio

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-08-19 11:04:32 -07:00
Sathish Kuttan d9a283d91a drivers: audio: TLV320DAC310x audio DAC driver
Adds an audio codec driver for the TI TLV320DAC310x audio DAC

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-08-19 11:04:32 -07:00
Sathish Kuttan 73c1093229 drivers: audio: Add audio support in Kconfig
Added an entry in drivers/Kconfig for audio
Added an entry in drivers/audio/Kconfig for audio codec
Added an Kconfig file in drivers/audio/ for TLV320DAC
Enabled audio coded in Intel S1000 CRB defconfig

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-08-19 11:04:32 -07:00
Nathaniel Graff ca12b3f7d4 drivers: gpio: SiFive GPIO allows <32 pins
Add ifdefs to the SiFive GPIO driver IRQ bindings to allow fewer than
32 pins to be configured based on the DTS configuration

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2018-08-18 10:46:36 -07:00
Johann Fischer 7a507d3ea5 drivers: apds9960: add dt bindings
Add dt bindings.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-08-17 13:19:20 -07:00
Johann Fischer 6c9eb734a7 drivers: hdc1008: add dt bindings
Add dt bindings for HDC1008 sensor.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-08-17 13:19:20 -07:00
Johann Fischer acc5312b6c drivers: hdc1008: do not use hardcoded I2C address
Do not use hardcoded I2C address.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-08-17 13:19:20 -07:00
Mieszko Mierunski 4f6aac1a67 dts: nrf5: Changed GPIO and GPIOTE define names
Changed names using nrf5 to nrf for consistency with other drivers.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Mieszko Mierunski d25c887f63 drivers: nrf: Remove redundant gpio_nrf5 shim
After GPIO shim using NRFX has been implemented, old gpio_nrf5
shim is no longer needed.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Mieszko Mierunski 15813d343c boards: nrf: Changed GPIO default driver to NRFX shim
I removed GPIO configuration from board files and enabled them
as default in driver Kconfig file. All boards had GPIO ports
enabled that is why I decided to enable it by default.

Power management example was changed to use new driver.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Mieszko Mierunski 6d8220d27f drivers: gpio: Add shim for nrfx GPIO and GPIOTE drivers
Added shim implementation gpio_nrfx.c which uses nrfx drivers
for GPIO and GPIOTE

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Mieszko Mierunski e99e363cc0 dts: nrf: Added DTS support for nRF51
DTS for nRF51 was missing, I updated soc and board files to
support DTS properly.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-08-17 07:29:14 -07:00
Flavio Ceolin 0866d18d03 irq: Fix irq_lock api usage
irq_lock returns an unsigned int, though, several places was using
signed int. This commit fix this behaviour.

In order to avoid this error happens again, a coccinelle script was
added and can be used to check violations.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-08-16 19:47:41 -07:00
Kiril Zyapkov 0d47ae4fca drivers: rtc: add support for STM32 RTC
Add support for the STM32 Real-Time-Clock leveraging the LL APIs

Signed-off-by: Johannes Hutter <johannes@proglove.de>
Signed-off-by: Kiril Zyapkov <k.zyapkov@allterco.com>
2018-08-16 13:38:43 -07:00
Johannes Hutter 41b7e7aa19 drivers: led: Add LED driver support for TI LP5562
Add support for TI LP5562 I2C 4-channel LED driver.

Supported blinking period: 1ms - 1000ms
Supported brightness value: 0% - 100%

This driver supports the entire currently available API.

Signed-off-by: Johannes Hutter <johannes@proglove.de>
2018-08-16 06:28:53 -07:00
Nathaniel Graff 218d7a0aa9 riscv: Rename the FE310 SoC to Sifive Freedom
FE310 is the name of one SoC out of a range of products in the SiFive
Freedom line. The FE310 SoC port in Zephyr is compatible with all of
these products, so rename the SoC to SiFive Freedom

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2018-08-16 06:23:01 -07:00
Istvan Bisz ea9d4a79c9 drivers: usb: add support for USB OTG FS on STM32F2
Add support for usbotg_fs, by adding the DT fixup, pinmux macros,
and the DT entries in stm32f2.dtsi.

Signed-off-by: Istvan Bisz <istvan.bisz@t-online.hu>
2018-08-16 06:19:19 -07:00
Alexander Wachter 39cb4b4167 drivers: can: Fix Issue #8226
This commit is a fix for Issue #8226
- Error flags are assigned to the correct mailbox now.
- set_filter_mutex is moved from can_stm32_attach to the wrappers
  can_stm32_attach_isr and can_stm32_attach_msgq. This protects
  response_type variable.
- Waiting for empty mailbox semaphore return value
  is checked for none zero values to check all error states.
- The mailbox tx_int_sem is reset before the sending is triggered.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-08-15 08:23:02 -05:00
Daniel Egger eaca7d78ce drivers: ethernet: Kconfig: Document availability of eth_stm32_hal
The eth_stm32_hal has been tested to work correctly on Nucleo-F207ZG,
Nucleo-F429ZI, Nucleo-F746ZG and Nucleo-F767ZI.

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2018-08-15 08:17:48 -05:00
Daniel Egger eb737280c0 drivers: pinmux: stm32: STM32F2 added ETH support to pinmux and use it
This patch adds support for Ethernet in the STM32F2 family of
microcontrollers and enables it for the the Nucleo-F207ZG.

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2018-08-15 08:17:48 -05:00
Ulf Magnusson 8cf8db3a73 Kconfig: Use a short, consistent style for prompts
Consistently use

    config FOO
            bool/int/hex/string "Prompt text"

instead of

    config FOO
            bool/int/hex/string
            prompt "Prompt text"

(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).

The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.

Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/
how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:10:10 -07:00
Ulf Magnusson 17f1b0adec Kconfig: Switch to improved globbing statements
A design flaw of 'gsource' is that there's no way to require at least
one file to match the glob pattern. This could lead to silent errors.

Switch to a new design, where a plain 'source' is globbing and requires
at least one file to match. A separate 'osource' (optional source)
statement is available for cases where it's okay for a pattern (or plain
filename) to not match any files.

'orsource' combines 'osource' and 'rsource' (relative source).

This commit search-replaces 'gsource' with 'source', but backwards
compatibility with 'gsource' is still maintained by making it an alias
for 'osource' (and by making 'grsource' an alias for 'orsource').

The three Kconfig files arch/{nios2,posix,xtensa}/Kconfig source
arch/{nios2,posix,xtensa}/soc/*/Kconfig, which doesn't match any files.
Use 'osource' for those. The soc/*/Kconfig files seem to be for
additional SoC-specific symbols, only none exist yet on those ARCHes.

Also use 'osource' for the source of $ENV_VAR_BOARD_DIR/Kconfig in
boards/Kconfig, which doesn't exist for all boards.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:07:44 -07:00
Andrzej Głąbek 2469097b34 drivers: nrfx: Allow simultaneous use of SPI_0 and I2C_0 on nRF52810
In most Nordic SoCs the SPI and TWI peripherals with the same instance
number share certain resources and cannot be used at the same time.
In nRF52810 there are only single instances of these peripherals and
they are arranged in a different way so this limitation does not apply.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-13 18:45:04 -07:00
Andrew Boie 06c23f157f i2s: expose i2s APIs to user mode
User mode may now access the read, write, and trigger APIs.
Unlike supervisor mode, memory slabs are not dealt with directly,
the data is always copied.

A new driver API added to fetch the current channel configuration,
used by the system call handlers.

The i2s_sam_ssc driver updated for the new API. CAVS driver not
modified as there is no user mode port to Xtensa yet.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-08-13 16:44:09 -07:00
Nathaniel Graff 45d5d5db48 boards: riscv: Convert HiFive1 to DTS
Adds DTS bindings for sifive,pwm0, sifive,uart0, sifive,spi0, and
riscv,plic0.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
2018-08-13 18:35:38 -05:00
Piotr Zięcik 24abedbd14 driver: timer: nrf: Remove redundant RTC_COUNTER reads.
This commit removes redundant reads of RTC_COUNTER register
propagating optimizations made in the k_cycle_get_32() function.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-08-13 13:10:50 -07:00
Piotr Zięcik 1dfd33b7ad drivers: timer: nrf: Optimize k_cycle_get_32().
The previous implementation of _timer_cycle_get_32() (which is directly
mapped to k_cycle_get_32()) taken from 87 to 132 cycles. As result it
was too heavy for using it as source of time for logger.

This commit makes this function faster by removing redundant access
to the RTC register (each access consumed 28 CPU cycles) as well as
loop, which made this call non-deterministic.

After these changes the k_cycle_get_32() needs only 50-52 cycles
in to calculate 32-bit timestamp.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-08-13 13:10:50 -07:00
Diego Sueiro 72cad66c5b drivers/sensor/fxas21002: Fix race condition during initialization
A race condition was identified during the initialization of the
driver when the trigger function is enabled. This exposed two issues:

1 - The fxas21002_handle_int is trying to acquire the semaphore before
    it gets initialized. To solve this we need to initialize the
    semaphore before calling the fxas21002_trigger_init function.

2 - During the fxas21002_trigger initialization the i2c bus is used
    (from fxas21002_handle_int function) at the same time as the
    fxas21002_set_power is being called. To fix this we need to
    initialize the semaphore with 0 and just release it after calling
    the fxas21002_set_power function in the fxas21002_int

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-08-13 09:05:54 -05:00
Diego Sueiro ed4f0ff36e drivers/sensor/fxos8700: Fix race condition during initialization
A race condition was identified during the initialization of the
driver when the trigger function is enabled. This exposed two issues:

1 - The fxos8700_handle_int is trying to acquire the semaphore before
    it gets initialized. To solve this we need to initialize the
    semaphore before calling the fxos8700_trigger_init function.

2 - During the fxos8700_trigger initialization the i2c bus is used
    (from fxos8700_handle_int function) at the same time as the
    fxos8700_set_power is being called. To fix this we need to
    initialize the semaphore with 0 and just release it after calling
    the fxos8700_set_power function in the fxos8700_int

These two scenarios was reproducible in the WaRP7 board with i.MX7 SoC.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-08-13 09:05:07 -05:00
Ulf Magnusson ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Vinayak Kariappa Chettimada ddb7f88f9e drivers: entropy: nrf5: Fix ENTROPY_BUSYWAIT implementation
Fixed the ENTROPY_BUSYWAIT implementation from vectoring to
RNG ISR which was preventing the busywait loop to hang
waiting on the VALRDY event which was getting cleared in the
ISR.

Fixes #9356.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-08-10 15:16:18 +02:00
Jukka Rissanen f9aa9783d0 drivers: eth: native_posix: Allow user to manipulate zeth status
User can take the zeth interface down by issuing "net iface down <idx>"
shell command. It is possible to take the interface up by typing
"net iface up <idx>" in shell. These commands are important for
native_posix as there is no physical cable that can be connected
or disconnected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-10 12:36:19 +03:00
Andrzej Głąbek ead399914e drivers: watchdog: nrfx: Remove false dependency on CLOCK_CONTROL_NRF5
This driver no longer uses any clock control API, so the dependency
became outdated.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-08 17:23:55 +02:00
Andrzej Głąbek 16e8860f6c drivers: i2c: nrfx: Use HAS_HW_NRF_* in driver options dependencies
Use the HAS_HW_NRF_* symbols instead of the SOC_SERIES_NRF* ones
to filter out the driver options unavailable on particular SoCs.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-08 17:23:55 +02:00
Andrzej Głąbek 841b8400e2 drivers: spi: nrfx: Remove "optional" from driver type choices
Selecting the type of driver (SPI, SPIM, or SPIS) to be used for
a given SPI instance is mandatory, so the "optional" modifier is
inappropriate for related choice options in the driver's Kconfig.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-08 17:23:55 +02:00
Andrzej Głąbek a2bfd819c8 drivers: spi: nrfx: Use HAS_HW_NRF_* in driver options dependencies
Use the HAS_HW_NRF_* symbols instead of the SOC_SERIES_NRF* ones
to filter out the driver options unavailable on particular SoCs.

Add comments explaining why the SPIM driver is not available for
nRF52832.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-08 17:23:55 +02:00
Paul Sokolovsky 2681199c29 drivers: serial: uart_sam: Fix typo in param name.
The refactor to add callback user data param in 57286afd, contained
typo just for this driver. It sneaked past the PR CI due to the fact
that issue affected just a couple of platforms, and we select just
a few of them randomly for PR CI (vs full CI).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-08-08 07:54:46 -05:00
Tomasz Gorochowik 0ffdd7fbad drivers: eth: gmac: Don't use Qav code without priority queues
Most of this code is unreachable with priority queues disabled because
of queue id validation.

Fixes #9295.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-08 14:32:16 +03:00
Jukka Rissanen 3913f1ae2f drivers: eth: Enable LLDP support for native_posix board
Needed for testing LLDP.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-08 09:53:24 +03:00
Jesus Sanchez-Palencia 34ff437b53 drivers: slip: Add LLDP support
Enable LLDP TX support on the slip ethernet driver.
Now when CONFIG_NET_LLDP is enabled, one can easily verify on a sniffer
(i.e. wireshark) that LLDP frames are being sent at the configured
interval with all mandatory TLVs enabled.

Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2018-08-08 09:53:24 +03:00
Jukka Rissanen b4e36133c2 drivers: eth: native_posix: Exec program after creating zeth
Allow user to configure a program that is executed after the
network interface is created and IP address is setup.
This can be used e.g., to start wireshark to capture
the network traffic of the interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-06 14:20:51 +03:00
Michael Scott 65af15bcc2 boards: arm: nrf52840_pca10056: add settings for WNC-M14A2A modem
These settings enable use of the WNC-M14A2A LTE-M modem as the default
network interface for the nRF52840-DK board (nrf52840_pca10056).

They include the following settings when MODEM_WNCM14A2A is selected:
- UARTE1 pin setup
- DTS / DTS fixup additions for WNC-M14A2A
- Kconfig settings for modem driver

Signed-off-by: Michael Scott <mike@foundries.io>
2018-08-06 10:43:46 +03:00
Michael Scott 01745c3844 boards: arm: frdm_k64f: add settings to use WNC-M14A2A LTE-M modem
These settings enable use of the WNC-M14A2A LTE-M modem as the default
network interface instead of ethernet.

They include the following settings when MODEM_WNCM14A2A is selected:
- UART 2 setup
- Avoid ETH_0 setup due to pin conflicts
- DTS addition for WNC-M14A2A
- Kconfig settings for modem driver

Signed-off-by: Michael Scott <mike@foundries.io>
2018-08-06 10:43:46 +03:00
Michael Scott 8b3d4ab6b8 drivers: modem: add modem shell extension
Add a set of modem shell commands to support modem development.

Start with:
modem list: Lists all registered modems and related information
modem send <modem receiver index> <command>: Send command to modem

Signed-off-by: Michael Scott <mike@foundries.io>
2018-08-06 10:43:46 +03:00
Michael Scott 042d79e86c drivers: modem: add Wistron WNC-M14A2A LTE-M Modem Driver
The WNC-M14A2A (LTE / LTE-M) modem is presented as an Arduino-
compatible shield via AT&T's IoT Starter Kit v1.0.  It was
originally intended to work with the FRDM-K64F board, but
in theory as long as the right pins are configured it can
work with any board that supports Arduino-compatible headers.

The driver utilizes the CONFIG_NET_OFFLOAD setting to avoid the
normal handling of IP packets, and instead uses a socket-like
UART interface to handle incoming and outgoing data.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-08-06 10:43:46 +03:00
Michael Scott 9182d2e59c drivers: modem: add modem receiver (tty) driver
Modem drivers need a fast buffer-based receiver for passing data
back and forth from the UART to the driver.  This provides an
efficient configuarable driver which merely sends and receives
but doesn't process the data, that's left up to the modem driver.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-08-06 10:43:46 +03:00
Tomasz Gorochowik ef96384d25 drivers: eth: gmac: Finish 802.1Qav support
This is a finishing commit in 802.1Qav support for SAM GMAC. It adds a
possibility to get and set all parameters required by the standard.

Note that to be fully compliant it requires a proper system
configuration, but the prioritizing mechanisms will work just fine
without it so it is not enforced in any way.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-06 10:37:09 +03:00
Tomasz Gorochowik b15c3cb5b6 drivers: eth: gmac: Prefer routing packets based on TC
If the application is using TC configuration compatible with HW
configuration (equal number of traffic classes and hardware queues)
setup the screening registers and chose queues based on the chosen TC
mapping.

Use the VLAN priority and hard-coded mappings only as a fallback.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-06 10:37:09 +03:00
Tomasz Gorochowik 78b6dc6dea drivers: eth: gmac: Do not implicitly enable Qav
Updating Qav params made it implicitly enable the Qav support itself.
Since we can now control the on/off status with a management request,
this is not a desired behavior.

Make it read the original register value before updating params and then
writing back what it was before.

Additionally we now have to explicitly enable Qav support in init.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-06 10:37:09 +03:00
Tomasz Gorochowik bdd2e5911f drivers: eth: gmac: Fix idle slope setting
The standard (and therefore the upper layer) is using bits per second,
the registers in SAM GMAC uses bytes per second - do the conversion
before writing the reg.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-06 10:37:09 +03:00
Paul Sokolovsky 57286afdd6 drivers: uart: Allow to pass arbitrary user data to irq callback
Zephyr UART drivers offer very low-level functionality. Oftentimes,
it would be useful to provide higher-level wrappers around UART
device which would offer additional functionality. However, UART
driver irq callback routine receives just a pointer to (low-level)
UART device, and it's not possible to get to a wrapper structure
(without introducing expensive external mapping structures). This
is an indirect reason why the current UARt wrappers - uart_pipe,
console - are instantiated statically just for one underlying UART
device and cannot be reused for multiple devices.

Solve this by allowing to pass an arbitrary user data to irq
callback, set by new uart_irq_callback_user_data_set() function.
Existing uart_irq_callback_set() keeps setting a callback which
will receive pointer to the device.

While public API maintains compatibility, drivers themselves need
to be updated to support arbitrary user data storage/passing (as
legacy uart_irq_callback_set() functionality is now implemented in
terms of it).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-08-02 19:20:12 +02:00
Flavio Ceolin d775c2f504 drivers: crypto: Fix input len size for cbc decryption
do_cbc_decrypt() was not accounting IV's size in the input buffer.

Note that tinycrypt expects that IV and cipher text to be contiguous,
but input length must consider only the cipher text.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-08-02 19:18:58 +02:00
Alberto Escolar Piedras 7c776c8c81 net: eth: native_posix: Add missing headers
unistd.h was missing (used by read, close..)

printk header was also missing, but replace it's use
with posix_print_trace: It is faster and does not require
any Zephyr functionality to work.
fflush is not needed in this case.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-02 19:14:19 +02:00
Alberto Escolar Piedras 4388cde90f arch posix: Allow including XOPEN extensions
The native_posix random driver uses random() and srandom()
whicha are old XOPEN POSIX extension (part of POSIX 2001).

To avoid compiler warnings due to the host libC headers
not including this prototypes otherwise, let's define
this 2 macros.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-02 19:14:19 +02:00
Alberto Escolar Piedras 00b07615fa native_posix: Add missing headers and function prototypes
A few function prototypes were missing in the native_posix
board and its drivers.
Let's add them.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-02 19:14:19 +02:00
Alberto Escolar Piedras 304f26c310 Bluetooth: Userchan: Add missing headers
Added 2 missing headers in drivers/bluetooth/hci/userchan.c
(used by read,write and strtol)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-02 19:14:19 +02:00
Ulf Magnusson 995411f4e2 drivers/i2c: kconfig: Clean up I2C Kconfigs a bit
- Get rid of duplicate I2C dependencies, which show up in the
  documentation as e.g. 'I2C && I2C'. The 'source's in
  drivers/i2c/Kconfig are already within an 'if I2C' block.

- Factor out I2C_GPIO_<n> dependencies in drivers/i2c/Kconfig.gpio into
  'if I2C_GPIO_<n>' blocks.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-02 19:12:52 +02:00
Tomasz Gorochowik 0272a537f9 drivers: eth: gmac: Don't verify RX buffers count for unit tests
There is no need to do that and this makes the compilation of unit tests
fail (See #9224).

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-02 10:49:45 +03:00
Vinayak Kariappa Chettimada 26d22b0075 clock_control: nRF5x: Fix HFSTAT and LFSTAT check
Fix the implementation to correctly check the status of
HFCLK and LFCLK states with respect to the requested
sources.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-08-02 01:04:46 +02:00
Vinayak Kariappa Chettimada 23c92100ac clock_control: nRF5x: Non-blocking 32KHz crystal oscillator startup
Added Kconfig option and implementation to support a
non-blocking startup of 32KHz crystal oscillator.

This will reduce the time from boot to application start
while the crystal startup happens in background.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-08-02 01:04:46 +02:00
Ulf Magnusson d1684a83a4 Kconfig: Clean up some symbol definitions
- Remove redundant 'n' defaults. 'n' is the default value for bool
  symbols.

  This makes the auto-generated documentation clearer as well: You get
  "implicitly defaults to n" instead of
  "- n if <propagated dependencies>".

- Shorten

      <type>
      prompt "foo"

  to

      <type> "foo"

  This works for all types, not just bool.

- Various formatting nits.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-01 12:47:17 -04:00
Alberto Escolar Piedras 45b1079b6c drivers: console: Kconfig: Improve native descriptions
Improve the prompts and help messages for the NATIVE options
to make them less ambigous

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-01 09:51:41 -04:00
Tomasz Gorochowik 805e2f2c79 net: eth: mgmt: Merge 802.1Qav related mgmt requests
There are too many individual requests for Qav related parameters. There
are more Qav parameters that need to be supported (and will be supported
soon - both on the GET and SET side). Handling it the way it was handled
so far would render the eth mgmt API dominated by Qav parameters. That
would make the file hard to read and understand.

Instead of that - use a single GET and SET requests for all Qav
parameters. This works by adding a separate enum with Qav request type
to the ethernet_qav_param struct.

Additionally this approach makes it much easier to document it all since
we now have just a single request and documentation comments in the
ethernet_qav_param struct.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-08-01 15:58:05 +03:00
Tomasz Gorochowik 55767ade42 drivers: eth: gmac: Implement Qav status callbacks
Add a possibility to dynamically enable and disable Qav for individual
queues.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-31 17:54:24 +03:00
Erwan Gouriou a10d178078 drivers/pinmux: stm32 fix ports_enable array definition
ports_enable array holds port clock information.
It is populated for all SoCs, but ports availability depends on
SoCs. The way it is defined today, location of the port in the
array depends on previous ports definition in SoC CMSIS files.
Though, port index is always the same irrespective of previous
ports availability in the SoC.
This will result in incoherency between port index and clock
information.
Fix this by setting a bogus value if port is not defined.
Return an error if bogus value is read.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-07-31 09:45:39 -05:00
Lars Knudsen 9c0d7813e5 drivers: sensor: Add support for MMA8451Q (3-axis accelerometer)
Only basic features supported initially but more could be added from:
https://www.nxp.com/docs/en/data-sheet/MMA8451Q.pdf

fixes #9006

A sample app will be provided in a separate PR.

Signed-off-by: Lars Knudsen <larsgk@gmail.com>
2018-07-31 09:07:54 -05:00
Tomasz Gorochowik 1b6e5f6143 drivers: eth: gmac: Enable 802.1Qav support
This commit makes the driver enable HW Qav support for all available
priority queues.

Note that the hardware doesn't support setting the deltaBandwidth
parameter directly, but it is possible to do this by calculating it
from the negotiated link speed.

The default settings are set according to 802.1Qav 34.3.1, that says:

  The recommended default value of deltaBandwidth(N) for the highest
  numbered traffic class supported is 75%, and for any lower
  numbered traffic classes, the recommended default value is 0%.

The default/recommended values can be changed using the ethernet
management API (set_config) - which this commit also adds.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-31 10:25:19 +03:00
Tomasz Gorochowik abd417c078 drivers: eth: gmac: Implement the get_config callback
Handle getting the number of priority queues. The total number of queues
for this driver is configured in kconfig so it is as simple as returning
a defined value in this case.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-31 10:25:19 +03:00
Jukka Rissanen 39ec52d2f1 drivers: eth: native_posix: Make sure sent pkt is freed properly
Follow the packet sending error code in the driver. If packet
cannot be sent, then return <0 to the caller and do not free
the packet. In practice this is not happening here but follow
this general rule anyway.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-31 10:03:46 +03:00
Alberto Escolar Piedras 55f6620c3e native_posix: Refactor cmd line options
For each driver/model with command line options.
Move its code for the board file into the driver/model file.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-07-30 22:13:46 -04:00
Daniel Leung 67b48ab2a8 drivers/i2c: i2c_dw: extends driver to support 8 controllers
This adds the necessary driver structs to support a total of 8
I2C controllers. This also allows each I2C controller to have
its own PCI vendor/device IDs.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-07-27 17:16:18 -04:00
Daniel Leung 982b4e14c4 drivers/i2c: extends Kconfig to support 8 controllers
This simply adds 3 set of new Kconfig options to support
a total of 8 I2C controllers.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-07-27 17:16:18 -04:00
Tomasz Gorochowik a43ed0f431 drivers: eth: gmac: rework timestamping
Use both PTP Peer Event and PTP Event timestamping registers when
necessary.

Also for non-PTP frames just use current time.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-27 20:29:15 +03:00
Tomasz Gorochowik 3dd1101cb3 drivers: eth: gmac: Minor reformatting
This change is needed to make checkpatch happy.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-27 20:29:15 +03:00
Tomasz Gorochowik 75d23d5916 drivers: eth: gmac: Add support for multiple hardware queues
This commit adds support for multiple hardware TX and RX queues.
The number of the queues to use can be configured through defconfig.

Packets are sent and received through different hardware queues
depending on their priority.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-27 20:29:15 +03:00
Tomasz Gorochowik 4e642f629a drivers: eth: gmac: Fix ptp clock rate re-calculation
This commit fixes how the registers values are calculated and makes sure
there is no overflow effect when converting back to int.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-27 20:29:15 +03:00
Tomasz Gorochowik 7dc9831d82 drivers: eth: gmac: Disallow drastic rate changes
This commit makes the driver disallow drastic clock rate changes.
These changes happen mostly in the very beginning, when the timestamp in
hardware is zeroed.
In such cases the set callback is called soon after and fixes the large
offset. Without this limit the clock offset oscillates for a longer
period before it properly syncs as the requested ratio jumps between
very large and very small values.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-27 20:29:15 +03:00
Tomasz Gorochowik 9099b24821 drivers: eth: gmac: Use correct iface for gPTP over VLAN
This commit fixes a memory leak happening when both gPTP and VLAN are
enabled.

It also moves the get_iface function up in the file so it is accessible
earlier without a redundant function declaration.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-27 20:29:15 +03:00
Tomasz Gorochowik aabaf98c65 drivers: eth: gmac: Enable gPTP support
This adds packet timestamping support to the GMAC driver.
It is based on the eth_native_posix and eth_mcux drivers.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-27 20:29:15 +03:00
Tomasz Gorochowik 525b0ce81b drivers: eth: gmac: Restore original frags data after transmitting
The pointers to pkt->frags->data are changed after transmitting.
Other layers (e.g. the gPTP drivers) assume that these will remain
unchanged. This patch adds a workaround for that issue and restores the
original pointers.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-07-27 20:29:15 +03:00
Karol Lasończyk 14112768c0 drivers: watchdog: Fix assert errors in nrf watchdog implementation
Bad function calls caused assertion errors in previous implementation.
This change introduces fixes to prevent those errors. In addition
nrfx_wdt_init function is moved to init function calling at the start of
zephyr.
There are additional changes. -EINVAL value is returning in install
function when watchdog timeout value is invalid (less or equal minimum
or greater than value supported by watchdog peripheral in Nordic's SoCs.
Additionaly condition to chech if low frequency clock is enabled was
removed. Watchdog peripheral requests LFCLK in hardware.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-07-26 22:22:03 -04:00
Karol Lasończyk e482feac9d drivers: watchdog: Align nrf wdt driver to new nrfx
New nrfx version brings fixes also in watchdog implementation.
Previously introduced workaround for supporting more than one channel
can be changed to driver-management solution.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-07-26 22:22:03 -04:00
Andrzej Głąbek 18226b1100 drivers: serial: Add power management to nRF UART driver
This patch changes the way the transmitter is handled in the UART
driver, so that it is activated only when there is something to send.
The current UART API does not allow to disable RX completely, since
the poll_in function description implies that UART must continuously
listen. To provide a way of disabling the entire UART and lowering the
current consumption, this patch adds the power management to the UART
driver. When instructed to enter any of the power saving states,
the driver will disable the UART, and it will enable the UART back
when it is switched again to the active state.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-07-26 12:11:17 -04:00
Gil Pitney e189f59031 drivers: wifi: simplelink: enable Fast Connect policy
This enables the cc3220sf_launchxl to automatically
reconnect to the last good known access point (AP).

This method avoids the need to:
- perform a wifi scan for access points on bootup (saving power);
- include hard-coded SSID/passwords in the wifi application.
- include the wifi shell in the wifi application.
- rely on more complex provisioning methods;

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-07-26 13:57:34 +03:00
Tomasz Bursztyka 5ebc86bdc6 net/ethernet: A device driver api uses struct device *dev
Always use struct device *dev as first parameter for a device driver
API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-07-26 13:55:38 +03:00
Aurelien Jarno 6c49ce16c2 drivers: i2c: stm32: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

This is basically reapplying commit 133a299b50 ("drivers: i2c: Kconfig:
Remove redundant 'default n' properties"), which has been partially
reverted in commit c7875b75aa ("i2c: stm32_v2: implement slave
support").

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-07-25 07:19:12 -04:00
Aurelien Jarno 97bc5abedf drivers: i2c: stm32: add support for STM32F7
The STM32F7 uses the V2 version of the STM32 I2C controller. Add the
corresponding Kconfig, DTS, DTS fixup and pinmux entries.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-07-25 07:19:12 -04:00
Andrei Emeltchenko 1f4e8d679b usb_dc_stm32: Fix FS mode
Fixes FS mode for STM32F7XX devices.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-07-24 22:27:17 -04:00
Yannis Damigos 48de3ec616 drivers: usb_dc_stm32: Add OTG HS full-speed PHY support
Enable the driver to work in full-speed mode on OTG HS
controller using its full-speed or high-speed internal
PHY.

Please note that only one interface should be enabled
at a time, OTG FS or OTG HS. The driver will raise an
error if both are enabled.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-07-24 22:27:17 -04:00
Tomasz Bursztyka 39db4f48d7 drivers/ieee802154: Fix settings channel/tx power in uart pipe driver
Being stopped or not should not be a blocker on these settings (real
hardware can get these settings configured while not being in rx/tx
mode for instance).

Fixes #8528

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-07-24 20:40:51 +03:00
Zide Chen 50a08d9e8b loapic timer: LVTT should be programmed before ICR
Intel SDM Vol3 10.5.4.1 states that "A write to LVT Timer Register that
changes the timer mode disarms the local APIC timer".

This implies that LVT Timer register needs to be programmed before
Initial Count register, otherwise the LOAPIC timer could not be armed.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2018-07-24 09:19:33 -04:00
Zide Chen 07e913a1e5 ioapic: IOREGSEL register needs to be treated as 32 bits
If IOREGSEL register is not accessed with 32 bits, it may not be
intercepted by type 1 hypervisor correctly.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2018-07-24 09:04:05 -04:00
Jukka Rissanen af44d7c2e8 net: eth: native_posix: Add promiscuous mode support
Allow the zeth network interface to be placed into promiscuous mode.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-24 15:12:37 +03:00
Jukka Rissanen 9135b17535 net: eth: native_posix: Return proper error code from linux
Make sure that the system() call will return proper error code
to the ethernet driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-24 15:12:37 +03:00
Daniel Leung f9cd4995ff drivers/serial: ns16550: extend to support 4 ports
This extends the NS16550 driver to support 4 ports.
Also, this adds the necessary bits to enable PCI enumeration
on port 2.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-07-20 14:11:33 -04:00
Piotr Zięcik 2fe998cdef kernel: Deprecate sys_clock_us_per_tick variable.
On some architectures tick time cannot be expressed as integer
number of microseconds, introducing error in calculations using
sys_clock_us_per_tick variable.

This commit deprecates the sys_clock_us_per_tick variable and
replaces its usage by more precise calculations based on
sys_clock_hw_cycles_per_sec and sys_clock_ticks_per_sec.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-07-20 00:03:52 -04:00
Jonathan Yong 40f743669b net: eth: Convert to use callbacks to query stats
The advantage to this approach allows drivers for
devices that already keep statistics data on hardware
registers to use those instead, rather than try to
replicate it the same counters again within the driver
itself.

The eth_native_posix.c driver though do not benefit
from this, is modified to use the new callback system.

Suggested-by: Jukka Rissanen <jukka.rissanen@intel.com>
Signed-off-by: Jonathan Yong <jonathan.yong@intel.com>
2018-07-19 13:46:13 +03:00
Anas Nashif a2ad4b2dd1 drivers: qmsi: Fix types and u32_t/uint32_t conflicts
We have been mixing u32_t and uint32_t. Using u32_t when the API expects
something else.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-18 12:32:23 -04:00
Gil Pitney 42f51ef08d drivers: wifi: winc1500: Use offload_context instead of user_data.
The wifi_winc1500 driver's socket id is stored in
net_context->user_data, which may be overwritten later at
the socket layer, which also uses the net_context->user_data
field to store socket flags.

This patch introduces a dedicated offload_context field
for use by offload drivers, and updates the wifi_winc1500 offload
driver to use this field instead of user_data.

Fixes #8820

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-07-18 07:47:45 -04:00
Jukka Rissanen 77e03fc8be drivers: eth: mcux: Prioritize received PTP packets to high
Set the received PTP packet priority high so that those packets
will be handled first.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-18 07:37:41 -04:00
Jukka Rissanen 18d327c432 drivers: eth: mcux: Allow gPTP over VLAN
If VLAN is enabled for specific PTP interface, then manipulate
the ethernet header properly in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-18 07:37:41 -04:00
Jukka Rissanen d45f90e548 drivers: eth: mcux: Enable gPTP support
This adds packet timestammping support to the driver and configures
various PTP options in ENET.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Julien Chevrier <julien.chevrier@intel.com>
2018-07-18 07:37:41 -04:00
Diego Sueiro 51d1708648 drivers: add i.MX PWM driver
Adds the PWM shim driver for i.MX

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-07-17 16:08:22 -05:00
Olivier Martin a07d98a62f drivers: flash: w25q: Fix typo
'commands' was mispelled in all the file 'spi_flash_w25qxxdv_defs.h'

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-07-17 08:27:04 -04:00
Daniel Leung 7fd3eb60d9 drivers: uart_ns16550: restore config UART_NS16550_PORT_1_PCI
The CONFIG_UART_NS16550_PORT_1_PCI was accidentally removed in
commit 26b474c987. So adds it back.
This allows PCI driver to probe the resources for port 1.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-07-16 22:24:48 -04:00
Johann Fischer f5b91bad17 drivers: usb_dc_kinetis: fix gcc 7.3.1 warning
Use the same variable type for the odd bit handling
and fix the boolean expression warning with gcc 7.3.1.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-07-16 13:54:02 -05:00
Diego Sueiro ecc891b296 drivers: Fix asserts in i.MX UART Driver
After running some tests which enable assert macro I found some issues
with the i.MX UART configuration.

This patch configures the Tx Fifo Watermark and Modem Mode accordingly.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-07-16 11:04:18 -05:00
Ramakrishna Pallala 5f44309018 drivers: timer: nrf: Fix expected_sys_ticks issue in case of k_busy_wait
In case of tickless kernel, k_busy_wait() calls __enable_sys_clock()
which in turn calls _set_time() with maximum RTC counter programmable
value. This will set the expected_sys_ticks to maximum tick value even
though there is no explicit timeout is requested from the kernel or from
an application. In this scenario, if an app calls k_sleep() which in
turn calls _add_timeout() which will adjust timeout value as per the
elapsed program time which based on incorrectly set expected_sys_ticks.

To fix this issue, we should not set the expected_sys_ticks in case
of __enable_sys_clock() as it just requests to run the counter but
a timeout event request.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-07-15 22:48:34 -04:00
Vitor Massaru Iha f8718758e5 include: drivers: gpio: Turn functions generic - esp32
On 'drivers/i2c_esp32.c' there are functions useful for other
drivers. Functions and struct went moved to:

 * arch/xtensa/soc/esp32/peripheral.h
 * arch/xtensa/soc/esp32/soc.h
 * include/drivers/gpio/gpio_esp32.h

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-07-15 16:13:36 -04:00
Jakub Rzeszutko f0de6e06f8 drivers: serial: nrf: Serial driver modification to use DT
1. dts.fixup files updated with peripheral address and IRQ NUMBER.
2. Peripheral address is taken from DT.
3. IRQ number is taken from DT.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-07-13 11:08:03 +02:00
Gil Pitney c90170c5c5 drivers: wifi: simplelink: move files into a dedicated subdir
Place simplelink driver files into a subdirectory on par with
winc1500 subdirectory, to effect a better file organization.

No functional change in this patch.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-07-12 19:17:45 -05:00
Michael Hennerich 21fd91e11e drivers: sensors: adt7420: Add driver for ADT7420 Temperature Sensor
This patch adds support for the Analog Devices ADT7420 High-Accuracy
16-bit Digital I2C Temperature Sensors. Optionally sensor threshold
events are supported.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
2018-07-12 13:03:24 -05:00
Ioannis Glaropoulos ac81eb0eca drivers: gpio: nrf: remove GPIOTE register structure definition
This commit removes the redundant definition of nRF GPIOTE
register structure that is present in gpio_nrf5.c. The gpiote
driver is adapted to use the register definitions directly
from Nordic MDK header files.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-07-12 18:36:01 +02:00
Ioannis Glaropoulos 5275a73169 drivers: gpio: nrf: remove GPIO register structure definition
This commit removes the redundant definition of nRF GPIO
register structure that is present in gpio_nrf5.c. The gpio
driver is adapted to use the register definitions directly
from Nordic MDK header files.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-07-12 18:36:01 +02:00
Jun Li 9aa2488e7a soc: stm32f4: add pinmux defs for usb on pb14 and pb15
USB High Speed port on STM32F4 SoCs is pinned out from the
pin PB14 and PB15.

Signed-off-by: Jun Li <jun.r.li@intel.com>
2018-07-12 09:38:20 -05:00
Aurelien Jarno 9107e3dac8 drivers: usb: add support for USB OTG FS on STM32F7
The STM32F7 uses the same USB OTG FS controller than the STM32F4 series.
It is therefore trivial to add support for it, by adding the DT fixup
and pinmux macros, and the DT entries in stm32f7.dtsi. Keep it disabled,
it should be enabled at the board level.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-07-11 16:28:10 -05:00
Jakub Rzeszutko f733da8ded drivers: serial: nrf: Adopting define for UART driver.
Change define used to select interrupt driven functions
from CONFIG_UART_INTERRUPT_DRIVEN to CONFIG_UART_0_INTERRUPT_DRIVEN.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-07-11 10:03:03 +02:00
Jakub Rzeszutko 7449657e72 drivers: serial: nrf: Adding UARTE driver for the nRFx family
1. Added support for two instances of UARTE.

2. Kconfig.nrfx is capable to configure UART and UARTE driver.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-07-11 10:03:03 +02:00
Wayne Ren 8a528a797f drivers: serial: add virtual uart driver for nsim
In nsim, 'nsim_mem-dev=uart0,base=0xf0000000,irq=24'
is used to enable a virtual uart.

This uart is only used to output now, so only poll output
is implemented.

If required, input and interrupt driven are possible.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-07-10 19:05:13 -04:00
Christian Taedcke e9e8bce91b drivers: serial: Adapt gecko uart driver for Silabs EFR32
The gecko usart driver can now also handle the usart peripheral.

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2018-07-10 12:53:50 -05:00
Christian Taedcke 9ac99a28c5 drivers: gpio_gecko: Adapt driver for Silabs EFR32 MCUs
The EFR32 does not have DOUTSET and DOUTCLR registeres.

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2018-07-10 12:53:50 -05:00
Jakub Rzeszutko c8a2131743 drivers: serial: nrf: Adding missing baud rates to UART driver
Add missing baudrates supported by Nordic HAL:
 - NRF_UART_BAUDRATE_31250
 - NRF_UART_BAUDRATE_56000

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-07-10 13:51:34 +02:00
Jakub Rzeszutko 101d493622 drivers: serial: nrf: Use nrfx GPIO HAL to properly handle pins from P1
The dependency on the GPIO driver was a bit artificial, since the UART
driver used the GPIO API functions only to configure the pins at its
initialization. This configuration will be done by using nrfx GPIO HAL
functions directly, just like in case when a shim is using
an nrfx driver underneath.

HAL functions can be fed with the absolute pin numbers, that are
currently used for Nordic SoCs in Kconfig and DT, and for the GPIO
driver an additional translation would be required, to extract
the port and its relative pin number.

UART driver has to be initialized at PRE_KERNEL_1 (because of the
console using it) and currently the GPIO driver is initialized
at POST_KERNEL stage, so calling its API function form the UART
initialization routine was incorrect.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-07-10 13:51:34 +02:00
Vinayak Kariappa Chettimada 505a83414e drivers: gpio: nrf5: Fix GPIOTE channel use overlap
Fixes issues caused in GPIO driver due to overlapping GPIOTE
channel use in nRF5 software PWM driver and in Bluetooth
controller for implementing PA/LNA feature.

The issue is solved by assigning the base and available
channel count for GPIOTE considering whether PWM and/or
PA/LNA feature is selected in the Kconfig.

Fixes #8815.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-07-10 11:25:32 +02:00
Ulf Magnusson 0aedf8d2c5 drivers: console: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-08 22:12:54 -04:00
Diego Sueiro 8c2acab53a drivers: add i.MX I2C driver shim
Adds a shim layer around the imx i2c driver to adapt it to the Zephyr
i2c master interface.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-07-06 15:55:57 -05:00
Erwan Gouriou 2a490fd030 boards: Set nucleo_f429zi compatible with configuration guidelines
According to Default Configuration Guidelines, update nucleo_f429zi
- Add SPI_1, pinmux compatible with arduino spi
- Change PWM from PA0 to PE13 (Arduino D3)
- Disable I2C by default
- Update board dts with arduino connectors
- update board yaml file
- update board documentation

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-07-05 11:28:53 -05:00
qianfan Zhao bdeece01b8 driver: uart_stm32: add support for stm32f2 series
clear RXNE flag in fifo_read, remove TEACK and REACK
check when uart_stm32_init because stm32f2 doesn't
has those flags.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-07-05 11:26:07 -05:00
qianfan Zhao dffac9ab74 driver: interrupt_controller: Add support for stm32f2
Add kconfig and c code for stm32f2 interrupt controller driver

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-07-05 11:26:07 -05:00
qianfan Zhao 6488ab21a3 driver: pinmux: Add pinmux driver for stm32f2
Add driver header file for the stm32f2 pinmux

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-07-05 11:26:07 -05:00
qianfan Zhao 6fb7b04461 drivers: stm32-gpio: Provide GPIO driver for stm32f2
Add necessary GPIO defines for the stm32f2 series soc

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-07-05 11:26:07 -05:00
qianfan Zhao 6091a7fd50 drivers: clock_control: Add support for stm32f2
Add clock control support for the stm32f2

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-07-05 11:26:07 -05:00
Armando Visconti b29dabaf57 drivers/dma: dma_stm32f4x: use dma_slot to select peripheral
The DMA API provides dma_slot field as a method to configure at
runtime which peripheral DMA_request the DMA controller should
select.

This method allows to specify different selections for different stm32
DMA streams. So, all the Kconfig definitions, which by the way where
fixing the same selection for all DMA streams, have been deleted.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-07-05 11:24:59 -05:00
Armando Visconti 86de204852 drivers/dma: dma_stm32f4x: Fix Peripheral To Memory case
The Transfer Complete (TC) interrupt as well as the Memory
Increment (MINC) bits were not enabled for Periperal To
Memory (and Memory to Peripheral) case.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-07-05 11:24:59 -05:00
Daniel Egger b6da8be316 drivers: pinmux: stm32: STM32F7 added ETH support to pinmux
This patch adds support for Ethernet in the STM32F7 famlily
microcontrollers

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2018-07-05 11:23:42 -05:00
Johannes Hutter 6c0d089594 drivers: usb_dc_stm32: don't wait for semaphore in ISR context
usb_dc_ep_write may be executed in an ISR context and should therefore
not take a semaphore with a timeout. The semaphore was initially
introduced to prevent USB buffer overwrite when writing to an endpoint
in a loop. This is not requested anymore since there is an existing USB
transfer API available.

Signed-off-by: Johannes Hutter <johannes@proglove.de>
2018-07-05 11:06:30 -04:00
Sathish Kuttan 8a75e43bad drivers: dma_cavs: preserve DMA LLIs on stop
DMA channel linked list items (LLIs) are allocated when the channel is
configured.
The LLIs should not be freed until the channel is de-configured
Hence, k_free of LLI memory is removed from stop handler.
Also, added code to disable the channel in stop handler.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-07-05 11:05:16 -04:00
Andrzej Głąbek 28bf281231 drivers: pwm: nrf: Add nrfx_pwm.c to the build when PWM_NRFX is enabled
When the PWM_NRFX Kconfig option is enabled, add the nrfx driver
to the build automatically by selecting the NRFX_PWM option (it is
a hidden one, so the user cannot do it manually via menuconfig).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-07-05 11:58:51 +02:00
Jukka Rissanen 16f31f1d3c drivers: eth: native_posix: Enable gPTP support
Allow gPTP code to be run as a linux process and communicate
with gPTP daemon running in linux host.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-07-05 12:53:37 +03:00
Daniel Wagenknecht c7875b75aa i2c: stm32_v2: implement slave support
This patch adds I2C Slave support conforming to the syscalls and funcs,
only for the STM32 V2 I2C Driver for the moment.

It is capable of handling multi-master bus setups.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2018-07-04 11:57:33 +02:00
Neil Armstrong 9a73cdfe9e i2c: slave: Add EEPROM I2C Slave driver
Add a new EEPROM simulated driver with all it's build infrastructure.

The EEPROM can be loaded/poked from applications by getting its funcs.

It is multi-instance capable, right now 2 instances are supported by
enabling them in KConfig.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2018-07-04 11:57:33 +02:00
Neil Armstrong d55a6aa32d i2c: Add new I2C Slave syscalls
This patchs adds new I2C Syscalls for :
- I2C controllers slave support
- I2C Slave drivers support

I2C Controllers slave support adds 2 new ops to :
- register new slave driver
- unregister slave driver

Slave funcs consists on all the I2C phases :
- read or write request once address matches
- read or write done once the byte has been received/sent
- stop when the trasmit stops

I2C Slave drivers syscall are also added to make new
"I2C Slave" drivers to :
- register them to their I2C controller
- unregister them to their I2C controller

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2018-07-04 11:57:33 +02:00
Daniel Wagenknecht 81cfdec3a9 i2c: stm32_v2: restructure interrupt handling
This patch restructures stm32_i2c_v2 drivers Interrupts:
- NACK failures trigger an I2C event interrupt, so move
handling of NACK failure from error isr to event isr.
- Extract logic of interrupt handling to static functions. Use
isr functions (event & error OR combined) to call these. This
reduces duplication between error isr and combined isr.
- Restructure the error interrupt handling, so that it has no effect
when no errors occured and thus can be called by combined isr.
- Change interrupt logic from if/else to pure ifs for each flag.
This reduces code paths and leads to one call of the isr handling
multiple interrupt conditions, if there's more than one I2C
interrupt flags set.
This is the way it's done e.g. in linux kernels (since 4.14)
drivers/i2c/busses/i2c-stm32f7.c

Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2018-07-04 11:57:33 +02:00
Daniel Wagenknecht cc4191666b i2c: stm32: check messages before starting transmission
In preparation to implementing slave and multi-master
capabilities for STM32 I2C V2 driver move the checks,
whether all messages of a transfer are valid, before
starting the transaction.

This prevents having to abort a transmission, that is
already partly transmitted.

Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2018-07-04 11:57:33 +02:00
Aurelien Jarno 5aa09c6baa drivers: entropy: stm32: add support for STM32F7
All the STM32F7 SoCs have a TRNG. Adding support for it is just a matter
of tweaking the #ifdef and including the right file from HAL.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-07-03 22:48:08 -04:00
Kumar Gala 44e5b05fb1 drivers: gpio: nrfx: Move device tree selection to driver Kconfig
Move HAS_DTS_GPIO from board to the driver Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-07-03 18:46:41 -04:00
Ulf Magnusson dc9c0f1211 drivers: i2c: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 00ab5ed22a drivers: entropy: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 3ec8dd5744 drivers: led_strip: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 78fdf6925d drivers: aio: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson a81bc32677 drivers: ieee802154: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 21d4adef93 drivers: wifi: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 3e0a900a31 drivers: bluetooth: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 6d95448772 drivers: ptp_clock: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 7b0f00cf16 drivers: pci: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson cc74397a17 drivers: dma: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 38185db8fd drivers: display: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 2d50da70a1 drivers: ipm: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson a816d105a9 drivers: crypto: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson f912dfebea drivers: gpio: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Piggyback a missing 'source "drivers/gpio/Kconfig.imx"'. This file
wasn't included anywhere previously.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 133a299b50 drivers: i2c: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 120b8fc3a6 drivers: timer: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 27b9c05d4d drivers: can: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 09acea9f03 drivers: watchdog: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson f30b163624 drivers: pwm: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 2713e44594 drivers: adc: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 00f363e4c8 drivers: flash: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 86c46864ee drivers: ethernet: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 04cc6bff21 drivers: clock_control: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson d77663ac05 drivers: spi: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 31a0763ad6 drivers: net: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 8308a51930 drivers: counter: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson d7fa8b25aa drivers: pinmux: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson bfed59c1d4 drivers: led: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 7cdd946d2d drivers: usb: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson cddca70860 drivers: rtc: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson f7b441a8af drivers: grove: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Ulf Magnusson 13cb4cbb5f drivers: interrupt_controller: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Paul Sokolovsky ec6b6c9f0c eth: mcux: Add an option for randomized, but stable MAC address
The previous default, CONFIG_ETH_MCUX_0_RANDOM_MAC, result in a random
MAC address changed each reboot. As reboots happen quite often during
development, while Ethernet peers usually cache existing MAC addresses
in ARP cache, this led to situation when a board after reboot didn't
respond to pings or any other connection attempts for random amount of
time (upo to 10-20s). This was quite confusing and looked like some
problem in driver/hardware/connection/whatever.

Instead, introduce new option, CONFIG_ETH_MCUX_0_UNIQUE_MAC, to make
MAC address from MCU unique identification register. This results in
randomized/unique MAC address which is also stable over reboots and
avoids the situation described above.

Fixes: #3187

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-07-03 17:07:33 -04:00
Armando Visconti 5fa89ae164 drivers: pinmux: stm32f4: Added pinmux macros for I2S master
Define the pinmuxing for I2Sx_CK, I2Sx_SD and I2Sx_WS wires (with
'x' in the range 1 to 5). The multiplexing has been selected in
accordance to the ArgonKey board requirements.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-07-03 12:49:03 -05:00
Daniel Egger 536d77ab51 drivers: eth: stm32: Added missing ethernet_init() call
Fixes #8668

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2018-07-03 15:43:06 +03:00
Sebastien Bourdelin ac1a9c4ef2 drivers: led: Add LED driver support for NXP PCA9633
Add support for NXP PCA9633 an I2C 4-bit LED driver.
Supported blinkink period: 41ms to 10667ms
Supported brightness value: 0 to 100%

This driver supports the following APIs:

1. led_blink
2. led_set_brightness
3. led_on
4. led_off

Signed-off-by: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
2018-07-02 10:25:47 -05:00
Kumar Gala 1ce259d149 drivers: i2c: nrfx: Move device tree selection to driver Kconfig
Move HAS_DTS_I2C from board to the driver Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-07-02 09:46:22 -05:00
Jakub Rzeszutko 197740bdfe drivers: uart: nrf: fixing interrupt driven API
1. API function: uart_nrfx_irq_tx_enable is expected to enable and
trigger TXDRDY interrupt. Due to HW limiation before first byte has
been sent TXDRDY interrupt will not be triggered so it must be forced
by the software.

2. Common function: uart_nrfx_irq_tx_ready_complete is used for two
API entries: irq_tx_ready, irq_tx_complete because Nordic hardware does
not distinguish between them. This function returns 1 when driver is
ready to accept data and 0 otherwise.

3. Removed Hungarian prefixes.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-07-02 10:56:57 +02:00
Anas Nashif 80e6a978a6 kernel/drivers: fix compile warnings
Uncovered by clang we have some functions being only used conditionally,
so gaurd them to make them only available when those conditions are met.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-01 22:58:23 +02:00
Christophe Priouzeau b0c294ce48 bt: hci driver over spi: Configure BlueNRG-MS in controller mode
Configure BlueNRG in controller w/o host.
By disabling 'HCI_reset' via the quirk, we can request to
BluesNRG hardware to be on controller mode just after it is ready.
By the way it's no necessary to manage a 'HCI_reset' when BluesNRG are
initialised (and on controler mode).

Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-06-29 10:40:25 +02:00
Christophe Priouzeau cd0a8216e9 drivers/clock_control: stm32: fix HCLK calculation when using MSI
MSI clock signal can be selected in several ranges.
These ranges should be taken into account for calculating its
frequency and hence global system frequency.
Provide a Kconfig option to set MSI range.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
2018-06-29 10:40:25 +02:00
Christophe Priouzeau 7b02e6dc55 bt: hci driver over spi: BlueNRG-MS read until IRQ pin goes low
According to BlueNRG-MS ref manual, SPI master shoul read  from
controller as long as IRQ pin is high.
Introduce a new loop within spi_rx_thread to do so. Since
it is now possible to enter read loop with nothing to read, set
a max attempts limit to be sure to exit the loop.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
2018-06-29 10:40:25 +02:00
Olivier Martin 0ba41f5b46 drivers: serial: Fix syntax error
`uart_handler.c` does not build when `CONFIG_UART_LINE_CTRL`
is defined.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-06-29 10:18:48 +02:00
Krzysztof Chruściński 5a1313f804 drivers: console: rtt: RTT session awareness
In order to avoid bytes dropping when RTT output buffer is full,
RTT session detection algorithm is introduced to the RTT console.
If host session is detected console retries after wait state
expecting host to empty the buffer. If host session is not detected
console drops the byte without retrying.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2018-06-28 09:36:58 -05:00
Yurii Hamann 75d3d94c90 drivers: interrupt_controller: stm32: STM32F7 EXTI support
This patch adds EXTI support for STM32F7 family
microcontrollers.

Signed-off-by: Yurii Hamann <yurii@hamann.site>
2018-06-28 08:29:32 -05:00
Yurii Hamann 1fdc790ca2 serial: stm32: STM32F7 UART support
The patch adds serial driver support for STM32F7 family
microcontrollers, includes pinmux definitions and DTS fixup file.

Signed-off-by: Yurii Hamann <yurii@hamann.site>
2018-06-28 08:29:32 -05:00
Yurii Hamann 7482969da6 drivers: pinmux: stm32: STM32F7 pinmux support
This patch adds pinmux header file for STM32F7 famlily
microcontrollers

Signed-off-by: Yurii Hamann <yurii@hamann.site>
2018-06-28 08:29:32 -05:00
Yurii Hamann a229500d23 drivers: gpio: stm32: STM32F7 GPIO support
This patch adds GPIO support for STM32F7 family microcontrollers.

Signed-off-by: Yurii Hamann <yurii@hamann.site>
2018-06-28 08:29:32 -05:00
Yurii Hamann 4df673f3fc drivers: clock_control: STM32F7 family clock control
This patch adds clock control support for STM32F7 family
microcontrollers.

Signed-off-by: Yurii Hamann <yurii@hamann.site>
2018-06-28 08:29:32 -05:00
Ulf Magnusson 19d7803546 drivers: sensor: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-27 17:20:10 -05:00
Tomasz Gorochowik ff41ef477e drivers: eth: gmac: Cast to type expected by HAL
This is needed to avoid compilation warnings when using both the
built-in libc and newlib.
The warnings were caused by typedefs incompatibilities.

This was agreed to be the temporary solution at the TSC.

See #8469 for more details.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-06-27 11:35:57 -05:00
Jukka Rissanen 8ae6bad21d net: l2: Move the layer 2 code into subsys/net/
The subsys/net/ directory is more logical place for L2 code instead
of ip/ directory. No functionality changes by this commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-27 17:02:59 +03:00
Alberto Escolar Piedras 9e82ef13af drivers: entropy: nrf5: Use nrf_rng hal for registers w sideeffects
A few registers with sideeffects were not using the HAL yet.
Fixed.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-26 14:49:50 +02:00
Jukka Rissanen ed25a16a3b driver: ptp_clock: PTP clock driver definition
Defines a PTP clock driver that can be implemented in those network
interface drivers that provide gPTP support.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Julien Chevrier <julien.chevrier@intel.com>
2018-06-26 12:37:28 +03:00
Jakub Rzeszutko daef3cc5be drivers: uart: nrf: fixing hardware flow control
Commit: 8a255eaf39d3e1a170297fc59c4674c080f99db8
broke flow control initialization.
This PR adds missing:
 - GPIO initialization for RTS and CTS.
 - RTS and CTS pins assignment for flow control.
 - Function for setting default hight state for TXD and RTS pins.
In addition obsolete cast to void has been removed.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-06-25 14:39:25 +02:00
Alberto Escolar Piedras 5ea637d23b drivers: entropy: native: implement standard ISR-specific call
For the native_posix board, implement the new get_entropy_isr call.
The old native get_entropy was already safe for ISRs, so we just
add a wrapper to it.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-22 12:29:02 -04:00
Jamie McCrae 23ce6f44b5 drivers: flash: w25qxxdv: Add options for delay and device ID
Adds support for configuring the CS toggling delay and using a
different device ID so that compatible flash chips can also be
used by this driver.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdtech.com>
2018-06-22 12:27:40 -04:00
Justin DeMartino cfc18f2102 drivers: pwm: Add shim for nrfx PWM HW driver
Adds a translation layer to make the nrfx driver for nrf52 PWM
peripheral accessible via the Zephyr's API.

Signed-off-by: Justin DeMartino <jdemarti@gmail.com>
2018-06-22 11:56:01 +02:00
Ulf Magnusson d930c21e12 drivers: spi: Fix SPI_2_NRF_SPIS-related dependency loop
The following dependency loop existed:

  config SPI_SLAVE
  	bool

  (Defined at drivers/spi/Kconfig:27)

  ...is selected by...

  config SPI_2_NRF_SPIS
  	bool
  	select SPI_SLAVE

  (Defined at drivers/spi/Kconfig.nrfx:210)

  ...is in the choice...

  choice
  	bool
  	depends on SPI_2

  (Defined at drivers/spi/Kconfig.nrfx:192)

  ...that depends on...

  config SPI_2
  	bool
  	depends on SPI_SLAVE

  (Defined at
  arch/x86/soc/intel_quark/quark_se/Kconfig.defconfig.series)

  ...that again depends on SPI_SLAVE

(This might not be a problem in practice, but it'd be difficult to
detect.)

I think the underlying issue is that SPI_2_NRF_SPIS 'select's SPI_SLAVE,
while SPI_2 'depends on' it.

Fix it by having SPI_2_NRF_SPIS 'depend on' SPI_SLAVE as well. This will
require SPI_SLAVE to be explicitly enabled before SPI_2_NRF_SPIS can be
enabled.

No configuration files in Zephyr itself seem to currently enable
SPI_2_NRF_SPIS (and it defaults to n), so no tweaks should be needed
there.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-20 15:53:38 -04:00
Olivier Martin 2b10dd8a0b drivers: rtc: Fix build
_impl_rtc_(enable|disable) does not return a value while
Z_SYSCALL_HANDLER(rtc_(enable|disable)) expects to return a value.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-06-20 15:46:09 -04:00
David B. Kinder 90380730b3 doc: fix misspelling in watchdog Kconfig
fix misspellings missed during regular review

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-06-20 12:36:48 -04:00
Karol Gugala 1765d75ff4 riscv32: riscv-privilege: Microsemi Mi-V support
This commit adds support for Microsemi Mi-V RISC-V softcore CPU
running on the M2GL025 IGLOO2 FPGA development board.

signed-off-by: Karol Gugala <kgugala@antmicro.com>
2018-06-20 11:57:07 -04:00
Karol Gugala 23a5b5d171 riscv32: riscv-privilege: integrate common code
This commit moves code from fe310 platform into RISC-V privilege common
folder. This way the code can be reused by other platforms in future.

signed-off-by: Karol Gugala <kgugala@antmicro.com>
2018-06-20 11:57:07 -04:00
Karol Gugala 5417f29def drivers: plic: do not compile plic for qemu target
RISC-V qemu does not use PLIC controller, so plic.c file fails to
compile with qemu target. This change disables plic if qemu is
chosen.

signed-off-by: Karol Gugala <kgugala@antmicro.com>
2018-06-20 11:57:07 -04:00
Mieszko Mierunski dc1c2742b6 boards: nrf: Moved SDA and SCL pin configuration to DTS for nRF boards
SDA and SCL pins can now be configured through DTS.
Pins on development kits have been assigned according to arduino
headers.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-06-20 13:38:18 +02:00
Mieszko Mierunski 1aa61d60c5 drivers: i2c: Removed redundant i2c_nrf5 shim
After switching to TWI and TWIM drivers, old i2c_nrf5 shim
is no longer needed.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-06-20 13:38:18 +02:00
Mieszko Mierunski 1edc29c47f drivers: i2c: Add shims for nrfx TWI and TWIM drivers
Changes add a translation layer to make nrfx TWI and TWIM drivers
work with Zephyr API.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-06-20 13:38:18 +02:00
Sritej Kanakadandi Venkata Rama 6f61f09803 drivers: can: Set a initial state to the can device before HAL_CAN_Init
As part of HAL_CAN_Init we check the initial state of the can handle.
Setting it to HAL_CAN_STATE_RESET as an initial state to start the
Init properly.

Resolves: #8416
Coverity-CID: 186580

Signed-off-by: Sritej Kanakadandi Venkata Rama <sritej.kvr@gmail.com>
2018-06-19 20:46:25 -04:00
Sathish Kuttan 1b0641e2e2 drivers: usb: Add High Speed support for DesignWare USB
Added CONFIG_USB_DW_USB_2_0
Updated global configuration register to use UTMI 16 bit PHY
Updated device configuration register to use High Speed

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-06-19 20:16:18 -04:00
Savinay Dharmappa e682652d8c drivers: usb: Fix build error for intel_s1000.
As not all controllers using DW usb doesn't inherit
the qmsi related header, use of QM_USB_MAX_PACKET_SIZE,
QM_USB_IN_EP_NUM and QM_USB_OUT_EP_NUM break the build
for such platform. Hence defined new macros and corresponding
change done in driver.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-06-19 15:52:03 -04:00
Jakub Rzeszutko fab8246bc5 drivers: serial: simplify Kconfig.nrfx by using HAS_HW_NRF_UART0
Condition:
depends on ((SOC_SERIES_NRF52X || SOC_SERIES_NRF51X) && (!SOC_NRF52810))
for displaing configuration for UART0 peripheral has been replaced with:
depends on HAS_HW_NRF_UART0.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-06-19 20:02:51 +02:00
Tomasz Gorochowik 0a6046cf31 drivers: eth: gmac: Ensure caches are enabled before using them
Attempts to clear/invalidate caches which are disabled lead to BUS
FAULTS.

Ensure they are enabled before using them.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-06-19 15:04:16 +03:00
Tomasz Gorochowik a313e5c74f drivers: eth: gmac: Fix cache support for SAM GMAC
What needs to be done for the cache to work properly:
* Make sure cache operations are aligned to 32B
* Make sure to clean and invalidate the operations on gmac descriptors
  (thus all the helper functions)

This commit is needed for SAM GMAC to work when caches are enabled and
MPU mapping is changed to cacheable (See #8185)

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-06-19 10:48:24 +03:00
Aurelien Jarno 7688f49065 drivers: usb_dc_stm32: change all endpoints to bidirectional
The various STM32 reference manuals sometimes define the USB endpoints
as IN or OUT only and sometimes as bidirectional, even in the same
manual. This is likely because the OTG implementation has one set of
registers for the IN endpoints and one other set for OUT endpoints.
However at the end a given endpoint address can both transmit and
receive data.

This causes some confusion how to declare the endpoints in the device
tree, and depending on the SoC, they are either the same number of IN
and OUT endpoints declared, or they are declared as bidirectional. At
the end it doesn't really matter given how the driver uses those values:

    #define NUM_IN_EP (CONFIG_USB_NUM_BIDIR_ENDPOINTS + \
                       CONFIG_USB_NUM_IN_ENDPOINTS)

    #define NUM_OUT_EP (CONFIG_USB_NUM_BIDIR_ENDPOINTS + \
                        CONFIG_USB_NUM_OUT_ENDPOINTS)

    #define NUM_BIDIR_EP NUM_OUT_EP

This patch therefore cleanup the driver, the DTS, and the DTS fixups to
only define the number of bidirectional endpoints.

In addition to the cleanup, that fixes a regression introduced by commit
52eacf16a2 ("driver: usb: add check for endpoint capabilities"), which
introduced a wrong check for SoC only defining the number of
bidirectional endpoints.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-06-18 15:24:15 -04:00
Alexander Wachter c601f3be67 can: Add can support for STM32L432
This commit enables CAN on the STM32L432.
Tested on nucleo l432ck with external transceiver and loopback mode.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-06-18 15:23:29 -04:00
Alexander Wachter ebc31f6235 drivers: can: Prepare STM32 driver for other series than STM32F0
This commit splits the common interrupt into rx and tx parts because
only STM32F0 series has a common interrupt.
Moved clock source definition to device-tree.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-06-18 15:23:29 -04:00
Erwan Gouriou 13a96574cd drivers/serial: stm32: Put LPUART code under LPUART Kconfig symbol
In order to ease integration of new series, remove reference to
series in code activation. Use LPUART support Kconfig symbol instead.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-06-18 15:21:54 -04:00
Erwan Gouriou 80b8c501c9 drivers/serial: stm32: simplify check of TEACK/REACK flags
Remove reference to SoC series in activation of TEACK/REACK flags
checks. Use flags definitions instead which is defined, if supported,
in STM32Cube packages.
Decouple the checks since REACK is not supported in some series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-06-18 15:21:54 -04:00
Jun Li 03f2eb7f32 stm32_pwm: add pinmux port definition for pwm4
Define pinmux pin definitions for PWM4 on STM32F4

Signed-off-by: Jun Li <jun.r.li@intel.com>
2018-06-18 15:21:31 -04:00
Joakim Andersson fc4fc655d3 drivers: serial: Revert change to init level for nrfx uart driver.
The nrfx uart driver will get stuck in uart_poll_out function since
the uart_console driver has been initialized at PRE_KERNEL_1 level
and is making calls to the uart driver before the uart driver has been
initialized.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2018-06-18 12:08:47 -05:00
Johannes Hutter 392da5baee drivers: flash: w25qxxdv: Avoid locking when not threaded
When using CONFIG_MULTITHREADING=n, the semaphore primitives are
non-functional and useless. Remove their usage when this option is
enabled.

Signed-off-by: Johannes Hutter <johannes@proglove.de>
2018-06-18 12:31:06 -04:00
Ulf Magnusson 88de5bd84b drivers: serial: Remove SOC_NRF52810 Kconfig reference
This symbol will be added by
https://github.com/zephyrproject-rtos/zephyr/pull/7915.

Having it in there doesn't hurt that much by itself (undefined symbols
default to 'n'), but I'm about to turn references to undefined Kconfig
symbols turn into an error.

Remove the reference.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-18 11:25:35 +02:00
Alberto Escolar Piedras 78bf7518a9 drivers: entropy: nrf5: Use nrf_rng hal for registers w sideeffects
To enable for easier testing, replace direct use of registers
from Nordic's nrfx MDK with accesses via its HAL inlined functions

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-18 11:09:19 +02:00
Alberto Escolar Piedras 532201980d drivers: clock_control: Use nrf_clock HAL for registers w sideeffects
To enable for easier testing, replace direct use of registers
from Nordic's nrfx MDK with accesses via its HAL inlined functions

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-18 11:09:19 +02:00
Alberto Escolar Piedras 785faea8d4 drivers: timer: nRFx: Use nrf_rtc hal for registers w sideeffects
To enable for easier testing, replace direct use of registers
from Nordic's nrfx MDK with accesses via its HAL inlined functions

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-18 11:09:19 +02:00
Istvan Bisz 49554dd35a drivers: usb_dc_stm32: Change SYS_LOG_LEVEL
Suppress messages by DBG SYS_LOG_LEVEL setting:
[general] [ERR] usb_dc_ep_check_cap: ep 81, mps 64, type 2
[general] [ERR] usb_dc_ep_check_cap: ep 1, mps 64, type 2

Signed-off-by: Istvan Bisz <istvan.bisz@t-online.hu>
2018-06-17 10:49:16 -04:00
Carles Cufi 408ea1464b drivers: flash: nrf: Avoid locking when not threaded
When using CONFIG_MULTITHREADING=n, the semaphore primitives are
non-functional and useless. Remove their usage when this option is
enabled.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-06-16 12:03:22 +02:00
Gil Pitney 3bc77e88fb net: drivers: wifi: SimpleLink WiFi Offload Driver (wifi_mgmt only)
Initiate a SimpleLink WiFi Driver, implemented to the WiFi management
offload APIs for scan, connect, disconnect.

Also registers the DHCP-obtained IPv4 address upon connect.

This was validated on a cc3220sf_launchxl using the wifi
shell module from the Zephyr shell_module sample.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-06-15 10:01:21 -04:00
Johann Fischer 52eacf16a2 driver: usb: add check for endpoint capabilities
Add function to check capabilities of an endpoint.
Only basic properties are checked, especially on STM32
capabilities of different USB controller configurations
have to be considered in the future.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-06-15 11:02:05 +02:00
Tomasz Bursztyka 2fe51996db drivers/flash: Remove irrelevant option in w25qxxdv driver
CONFIG_SPI_FLASH_W25QXXDV_MAX_DATA_LEN is a left-over from old SPI API
usage. Now, there is no limit (besides the flash size) in SPI data
transaction.

Fixes #8327

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-14 14:41:52 -04:00
Marc Reilly 6c60abb03b drivers: gpio: add dts support for nrf52 gpio
This adds basic support for declaring gpio nodes in dts for nrf52.
The dts.fixup provides mapping for the generated defines to the config
defines currently used by the nrf gpio driver.

Existing boards that use nrf52 are updated.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2018-06-14 15:56:39 +02:00
Gautier Seidel 77643677a1 esp32: update to ESP-IDF v3.0-dev-2648-gb2ff235b
Recent ESP-IDF provides OS-agnostic wifi binary, needed by #3723

Closes #8240

Signed-off-by: Gautier Seidel <gautier.seidel@tado.com>
2018-06-13 18:53:43 -04:00
Ulf Magnusson 8df42eb4dc drivers: Replace ff hex constants with 0xff
This makes it easier to distinguish them from "true" undefined symbols.

Internally, all int/hex literals are treated as undefined symbols, which
always get their name as their value. The C tools work the same way.

The plan is to turn references to undefined Kconfig symbols into an
error later.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-13 13:35:56 -04:00
Ulf Magnusson 2a8349950e drivers: sensors: Consistently quote "GPIO_0" string default
These cases weren't caught by the heuristic used by the warning added in
commit 6eabea3a7e ("Kconfiglib: Warn for unquoted string defaults"),
because "GPIO_0" has no lowercase characters in it.

Unquoted Kconfig values are are indistinguishable from reference to
(undefined) symbols in general. Quoting all string defaults will help
find "true" references to undefined Kconfig symbols, and makes it
clearer that the value is constant.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-13 13:35:56 -04:00
Ulf Magnusson 2e6386f5af drivers: ieee802154: Remove GPIO_MCUX_PORT{A,B}_NAME Kconfig references
These symbols were removed by commit 4e8f29f319 ("gpio: Refactor the
mcux gpio driver to use dts"). The settings should come from DTS now.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-13 13:35:56 -04:00
Henrik Brix Andersen fc1898ccb5 drivers: pwm: pwm_nrf5_sw: Add prescaler support
Add support for specifying the clock prescaler value for the HF timer
used for generating the PWM signals. This allows for lower timer
frequency and thus slower PWM signals (e.g. for use as servo
controller).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-06-13 18:55:22 +02:00
Henrik Brix Andersen f5310d5b54 drivers: pwm: pwm_nrf5_sw: Fix calculation of cycles per second
The nRF5x HF timer base frequency is 16 MHz, not 16777216 Hz.

The improved accurracy of the PWM signal was verified with an
oscilloscope on a BBC micro:bit.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-06-13 18:55:22 +02:00
Erwan Gouriou d84795b0c1 drivers/dma: stm32: Use CMSIS IRQ defines instead of zephyr
stm32cube SDK provides defines for IRQ line numbers.
It was not possible to use them, since enum where not supported
by IRQ_CONNECT macro.
Use them in order to get rid of zephyr manually coded IRQ lines.
They will later be replaced by device tree definitions when
made available

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-06-13 11:43:56 +02:00
Erwan Gouriou 1002e904d5 drivers/exti: stm32: Use CMSIS IRQ defines instead of zephyr
stm32cube SDK provides defines for IRQ line numbers.
It was not possible to use them, since enum where not supported
by IRQ_CONNECT macro.
Use them in order to get rid of zephyr manually coded IRQ lines.
They will later be replaced by device tree definitions when
made available

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-06-13 11:43:56 +02:00
Jakub Rzeszutko 3f99eefe5a drivers: uart: Rename nrf5 namings to nrfx
UART driver renamed to keep the same convention as SPI and TWI drivers.
All substrings: "UART_NRF5" in defines renamed to  "UART_NRFX_UART".

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-06-12 13:21:18 +02:00
Jakub Rzeszutko e7252fbbfe drivers: uart: Refactor nrf uart shim
Replace all register defines and calls with Nordic nrfx HAL.
Simplification of uart shim - assumed only one uart instance.
Added parity bit to configuration options.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-06-12 13:21:18 +02:00
Florian Vaussard 653d75cfba pwm: stm32: Add PWM fixup for STM32* and remove Kconfig options
Add fixup info for PWM nodes on STM32F0/F1/F3/F4/L4 and remove the
conflicting Kconfig symbols to fully switch STM32 PWM to device tree.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-06-12 03:54:26 -04:00
Florian Vaussard 18f24f08f2 pinmux: stm32f3: Add PA8_PWM1_CH1
The nucleo_f334r8 uses STM32F3_PINMUX_FUNC_PA8_PWM1_CH1 inside its
pinmux but it is not defined anywhere.

Add the definition into the pinmux file to fix the build of
nucleo_f334r8 when enabling CONFIG_PWM.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-06-12 03:54:26 -04:00
Florian Vaussard bef42fad57 pwm: stm32: Fix driver to compile with STM32F0
CONFIG_CLOCK_STM32_APB2_PRESCALER does not exist for STM32F0 as it was
removed from the RCC Kconfig by commit d0678201c3 ("drivers:
clock_control: provide support for stm32f0."). This will break the PWM
driver if compiled for STM32F0.

Conditionally disable usage of this symbol for STM32F0 as all PWMs are
on APB1 for this family.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-06-12 03:54:26 -04:00
Florian Vaussard 079087483d pwm: stm32: Add STM32F0-specific clocks
PWM1 / PWM15 / PWM16 and PWM17 on STM32F0 do not use the same clocks
compared to the other series.

Add the STM32F0-specific clocks where needed.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-06-12 03:54:26 -04:00
Florian Vaussard c65499d485 pwm: stm32: Add clock group information
Not all PWM clocks belong to the GRP1, for example TIM1 on STM32F0. Add
the group information to the macro to enable supporting these PWMs in
the future.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-06-12 03:54:26 -04:00
Florian Vaussard 20365bac0e pwm: stm32: Do not hardcode the prescalers
The prescalers are currently hardcoded and are not user-selectable. As a
result, the frequency of the timer can be inadequate to the task. For
instance, the frequency of the 16-bit timers (prescaler 10000) is
usually too low to correctly generate of PWM of a few kilohertz.

Hardcoded prescalers are replaced by Kconfigs so the user can choose at
compile time. The default value of each Kconfig matches the hardcoded
prescaler, so the change will be transparent.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-06-12 03:54:26 -04:00
Florian Vaussard f34e74dba2 pwm: stm32: Add support for all PWMs up to PWM20
All the PWM between 1 and 20 can be found on the STM32 depending on the
serie and the specific model. Add all the missing PWMs up to PWM20 to
plan for the future needs.

Tested on STM32L496 with available PWMs.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-06-12 03:54:26 -04:00
Florian Vaussard 0bdcef9e00 pwm: stm32: Use macro to simplify registration
The registration of each PWM differs only by a few details.
These differences can be factorized in order to create a generic
registration macro.

This has several advantages:
- Less code
- Easier to add new PWM

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-06-12 03:54:26 -04:00
Piotr Zięcik 3f3a907bb8 drivers: timer: Use sys_clock_hw_cycles_per_tick in nrf_rtc_timer.
The nrf_rtc_timer used own method to calculate number of timer cycles
per tick. As the result value was different than the one used by
the kernel, the reported time was incorrect.

This commit fixes the problem described above by using global
sys_clock_hw_cycles_per_tick instead of custom RTC_TICKS_PER_SYS_TICK.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-06-11 17:38:13 -04:00
Sathish Kuttan 7b7784e149 drivers: dma_cavs: Add support for circular list
Added support for circular linked list of DMA buffers
This patch checks the last block supplied by the application
and if the next pointer in the last block is valid, the tail
linked list item is linked to the head linked list item
to form a circular linked list

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-06-11 17:34:04 -04:00
Vinayak Kariappa Chettimada edb2ad11f0 Bluetooth: controller: Remove redundant include of cmsis.h
Remove the redundant include of cmsis.h as soc.h already
includes it as necessary.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-06-11 17:30:29 -04:00
Loic Poulain ea5b866763 Bluetooth: hci: spi: Select BT_RECV_IS_RX_THREAD
SPI driver has its own rx thread, select BT_RECV_IS_RX_THREAD.
This fixes build issue because of undefined CONFIG_BT_RX_PRIO.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-06-11 17:28:27 -04:00
Rajavardhan Gundi e5b0e9ac07 DTS: interrupt controller: Define IRQ priorities for CAVS & DW ICTL
IRQ priorities for CAVS and DW were previously defined in Kconfig.
They are now defined via DTS and removed from Kconfig.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-06-11 17:27:58 -04:00
Jukka Rissanen e7206318fa drivers: eth: mcux: Inform IP stack when carrier is lost
If carrier is ON or OFF, then tell this information to upper IP stack
so that it can act accordingly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-11 17:27:29 -04:00
Armando Visconti 87bd2c25bf drivers: sensor: lis2dh: Fix I2C burst read/write operations
As stated in LIS2DH datasheet in section "5.1.1 I2C Operation",
in order to read/write multiple bytes on I2C it is necessary
to add the autoincrement bit to the subaddress field.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-06-11 17:20:21 -04:00
Evgeny Kalugin e16037d87a drivers: sensor: lis2dh: Fix of compilation issue
The lis2dh_burst_write used "bus" as an input parameters, while
inside "dev" was referred. Now variable names are aligned.

Signed-off-by: Evgeny Kalugin <evgeny.kalugin@intel.com>
2018-06-11 17:20:21 -04:00
Johan Hedberg 7d9896575b Bluetooth: Add HCI User Channel driver for native POSIX port
Introduce a custom HCI driver for the native POSIX port, which opens a
HCI User Channel socket to the Linux kernel to gain access to a local
Bluetooth controller.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-06-11 17:14:43 -04:00
Armando Visconti c7053643d5 spi: spi_ll_stm32: (fix) Clear OVR bit condition
The OVR condition in the Status Register requires a
particular sequence in order to be cleared. If not
done properly it stays set forever.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-06-04 12:35:52 -05:00
Tomasz Bursztyka b4d0850d5c drivers/rtc: Fix how prescaler is used in QMSI driver
The issue was introduced by commit-id 27bdb83.
RTC_DIVIDER used to be 0 by default, now it's 1.

Fixes #8098

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-04 12:24:23 -04:00
Tomasz Bursztyka a88a98665b drivers/flags: W25QXXDW internal erase logic fix
The old way of erasing was not completely moved to the new SPI access
function, thus always sending useless dummy bytes that could lead to
error (aka: erasing more than requested).

Fixes #8065

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-04 08:25:42 -04:00
Leandro Pereira 158ea970ea drivers: watchdog: Use common name configuration for all drivers
Each driver seemed to use their own Kconfig option to set the name for
their drivers.  This makes writing example/test code difficult as each
one of them will have to special case for each of the supported
platforms.

Use a consistent CONFIG_WDT_0_NAME option in all drivers.

Fixes #8094.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-01 15:31:56 -05:00
Leandro Pereira eefeb2b050 drivers: watchdog: esp32: Use common Kconfig option to disable at boot
Instead of relying on CONFIG_WDT_ESP32_DISABLE_AT_BOOT, use
CONFIG_WDT_DISABLE_AT_BOOT that's available for all watchdog timers.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-01 15:31:56 -05:00
Alexander Wachter b97dd472fb drivers: can: Move bit timing and clock to device tree
This commit moves the bit timing (PROP, BS1, BS2 segments and SWJ)
from Kconfig to the device-tree and fixes issue #7933

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-06-01 12:59:42 -05:00
Sathish Kuttan 9f4702b3b4 arch: soc: intel_s1000: set M/N divider ownership
Add bit definitions and set M/N divider ownership in
i2s_initialize.
Changes to comply with coding guidelines
Changes to address review comments

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-06-01 08:59:01 -04:00
Sathish Kuttan f36edc6c29 drivers: i2s: intel_s1000: Fractional bit-clock
Added support for fractional division of reference clock to obtain
I2S bit clocks
For example:
    If reference clock is 38.4MHz and
    if the I2S format is 2ch, 32bits per channel, 48KHz sample rate,
    the bit clock frequency has to be 2*32*48K = 3.072MHz
    38.4MHz/3.072MHz = 12.5 (a fraction)

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-06-01 08:59:01 -04:00
Erwan Gouriou f27195017a drivers/gpio: stm32 fix gpio device init prio
STM32 GPIO device initialization priority was set to
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT
Following introduction of __ZEPHYR_SUPERVISOR__ macro (#6835),
drivers intialization order have been reordered which blocks
some use cases now.
Increase GPIO init priority to get it initialized before SPI
and avoid a deadlock.

Fixes #7663


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-06-01 03:26:10 -07:00
Michael Scott 30dbf3c0e5 drivers: eth: mcux: use CONFIG_SYS_LOG_ETHERNET_LEVEL for syslog level
Don't hard code the syslog level to DEBUG, instead use the
CONFIG_SYS_LOG_ETHERNET_LEVEL setting like other ethernet drivers.

Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
2018-05-31 09:15:52 -05:00
Sathish Kuttan 9a7538b95d drivers: dma_cavs: separate callbacks per channel
Allow the application using DMA driver to register a callback for
a specific channel within the DMA device instead of one callback
per device.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-05-30 20:33:06 -04:00
Ruslan Mstoi 29b7cdc8de drivers: eth: native_posix: Fix malformed echo response
Native POSIX echo server sends malformed response to echo request of
size larger than 128 bytes (default size of each network data
fragment). Wireshark notices that by tagging echo request with "No
response seen". This commit fixes that issue.

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2018-05-30 20:30:19 -04:00
Johann Fischer 4d0a1912a6 drivers: usb_dc_kinetis: fix usb_dc_ep_read_continue
usb_dc_ep_read_continue can be called without usb_dc_ep_read_wait,
check if the current buffer is claimed by the controller
(transfer not finished) to prevent a faulty behavior.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-05-30 11:23:39 -05:00
qianfan Zhao 13e1c3c2f8 uart_console: delete char using BS(08H) or DEL(7FH)
Some serial tools such as 'minicom' send BS when press backspace,
not DEL, so delete char using BS or DEL.

Fixes: #7959

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-05-29 16:21:55 -04:00
Tomasz Bursztyka 33e3ae711e drivers/spi: Handle the case when tx buf/len is NULL/>0 in DW driver
This is a rare but valid case when you request the controller to send
dummy bytes on your behalf (it saves memory as you don't need to provide
a valid buffer, just NULL and the numbers of dummy bytes as length).

Without it, user code can get stuck into interrupt loop.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-29 16:21:08 -04:00
Tomasz Bursztyka 002031d87f drivers/flash: Cleaning up Kconfig
Splitting to dedicated Kconfig for w25qxxdv and qmsi.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-29 16:21:08 -04:00
Tomasz Bursztyka a6d8378377 drivers/flash: A support for SPI gpio-cs logic into w25qxxdv driver
Up to SPI API user code to handle providing the right SPI GPIO-CS
parameters now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-29 16:21:08 -04:00
Ulf Magnusson 10d54e2b22 boards: arm: argonkey: Properly set choice default
The choice symbol LSM6DSL_EXT0_LIS2MDL was given a 'default' in
Kboards/arm/96b_argonkey/Kconfig.defconfig, but 'default' has no effect
on choice symbols, triggering a warning from Kconfiglib.

Instead of adding a default to the choice symbol, change the default of
the 'choice' itself by giving it name and adding the default in
Kconfig.defconfig.

This requires that we remove the default on the "base" definition of the
'choice', due to some messiness related to the Zephyr-specific
prefer-later-defaults behavior (see the 'Zephyr-specific Kconfig
behavior for defaults' section in the Board Porting Guide). Choices were
overlooked when that patch was added to the C tools, meaning choices
still prefer earlier defaults. The crux is that Kconfig.defconfig files
are included last.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-29 16:19:51 -04:00
Rajavardhan Gundi ddba3d667d kconfig: Define the IRQ priorities for CAVS & DW ICTL
CAVS_ICTL_0_IRQ_PRI to CAVS_ICTL_3_IRQ_PRI and DW_ICTL_IRQ_PRI
are now defined in Kconfig. This addresses the issue #7811.

This was not throwing up any compilation error earlier as the IRQ
priorities are all hardwired in Xtensa and hence are unconfigurable.
They are dummy for Xtensa arch but may be applicable if used in some
other arch.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-05-29 15:46:41 -04:00
Punit Vara 8eb652bfd5 drivers: apds9960: Always default on I2C_0
Use I2C_0 instance by default for APDS9960

Signed-off-by: Punit Vara <punit.vara@intel.com>
2018-05-29 07:46:08 -07:00
Jukka Rissanen 8f5929ddf0 net: Too long timeout for k_sleep
Convert couple of MSEC() calls to K_MSEC() as the timeouts
when using MSEC() are just too long.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-05-28 17:20:11 -04:00
Adithya Baglody 8c812900e1 drivers: entropy: Remove usage of zephyr_library_ifdef
Phasing out the usage of this cmake macro from the drivers/entropy
folder.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-28 13:23:13 -04:00
Adithya Baglody 963a0bee8d drivers: serial: Remove usage of zephyr_library_ifdef
Phasing out the usage of this cmake macro from the drivers/serial
folder.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-28 13:23:13 -04:00
Adithya Baglody 5f5e9fb968 drivers: flash: Remove usage of zephyr_library_ifdef
Phasing out the usage of this cmake macro from the drivers/flash
folder.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-28 13:23:13 -04:00
Adithya Baglody 62004146e4 drivers: sensors: Remove usage of zephyr_library_ifdef
Phasing out the usage of this cmake macro from the sensor folder.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-28 13:23:13 -04:00
qianfan Zhao a8d934069e eth_stm32_hal: fix dev_data->mac_addr typo
fix typo: contdev_dataext -> dev_data

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-05-28 09:31:49 -05:00
Neil Armstrong 7fb245f9c6 spi: spi_ll_stm32: fix slave frame shifting
In the current form of the code, the slave frame shifting leaves the TX
full and will shift out some unwanted bytes out on the next transaction.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2018-05-28 10:18:23 -04:00
Andrzej Głąbek 373a02126e drivers: serial: nrf: Fix interrupts enabling/disabling
This patch corrects the way the INTENSET and INTENCLR registers are
accessed. When these registers are written with a bitmask, specified
bits are set or cleared in the INTEN (interrupt enabling) register,
so there is no need to read the previous state of these registers
(when they are read, the current state of INTEN is returned).
For INTENSET this patch eliminates only one unnecessary read, but for
INTENCLR the change is crucial because in the previous version any
write to the register disabled all the enabled interrupts.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-05-28 14:27:51 +02:00
Aurelien Jarno 8e15353de5 i2c: i2c_gpio: fix typos in Kconfig file
This file is about I2C bus, not the I2S one.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-05-26 19:07:55 -04:00
Erwan Gouriou d8fd97abe0 drivers/ethernet: stm32: Don't exit driver init on HAL timeout
In case ethernet cable is unplugged, stm32 ethernet driver triggers
an error, driver initialization fails and fw crashes.
This could be enhanced as in case not cable is connected, HAL
returns a Time out, and will resume its initialization when
cable is plugged.
Treat HAL timeout in ethernet driver initialization as a
recoverable error and continues driver init when it happens.

Tested with sample/net/dhcpv4_client. Start board with cable
unplugged. Wait some time before plugging the cable. DHCP request
is correctly performed when cable is plugged.

Fixes: #7127

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-05-25 13:07:05 -05:00
Armando Visconti bb9fe428d8 spi: spi_ll_stm32: Fix transceive() ret value in spi_slave case
In SPI slave case the transceive should return either the negative
errno code in case of error or the number of frames received.
So, now:

 1. the spi_stm32_get_err() routine already checks whether
    the SPI cell got an error and returns -EIO in that case.

 2. the transceive() routine always returns whatever the
    spi_context_wait_for_completion() has returned, which
    is either:
        a. -EIO in case of error
        b. 0 in spi_master ok case
        c. the number of frames received in spi_slave ok case

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-25 12:56:38 -05:00
Jun Li 8cc002e657 soc: stm32f1: add port uart4
Enable supporting UART4 on STM32F107 and STM32F103Xe SoCs.
Modified stm32f1/dts.fixup for replacing USART with UART.

Signed-off-by: Jun Li <jun.r.li@intel.com>
2018-05-25 11:58:20 -05:00
Ilya Tagunov 8b7c3cffb1 arch: arm: soc: stm32l0: add LPUART1 pinmux options
Add obvious and easily testable PA2/PA3 configuration
(same pins as USART2).

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-05-25 11:54:42 -05:00
Ilya Tagunov 1e6d827a53 drivers: serial: stm32: add LPUART support for L0/L4 series
LPUART (Low-power UART) peripheral is just like ordinary U(S)ART
which lives in a separate clock/power domain.
Therefore already existing code could be reused as is
almost entirely.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-05-25 11:54:42 -05:00
Ilya Tagunov 967c31bc07 drivers: serial: stm32: enable LBD only for UARTs with LIN support
LBD interrupt manupulation makes sense for UART with LIN support only.
Otherwise this bit should not be touched.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-05-25 11:54:42 -05:00
Ilya Tagunov fd26514a4d drivers: serial: stm32: rework macros and fixups
STM32Lx LPUART peripherals do not fit well into existing U(S)ART
port numbering scheme, so there will be two separate namespaces
in Kconfig: one for U(S)ARTs and one for LPUARTs.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-05-25 11:54:42 -05:00
Ilya Tagunov 6632ffa60f drivers: serial: stm32: remove HAL driver legacy
Remove UART_HandleTypeDef instance, which is used
only to store baudrate value.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-05-25 11:54:42 -05:00
Maureen Helm 7f4608cc61 gpio: Fix imx driver edge selection when configuring by port
Fixes a copy-paste error found by Coverity.

Coverity-CID: 186028

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-25 10:54:14 -05:00
Kumar Gala f245ef2aeb drivers: i2s: i2s_cavs: Fix typo in IRQ priority
The driver was using CONFIG_I2S_1_IRQ_PRI which doesn't exist.  It
should use CONFIG_I2S_CAVS_1_IRQ_PRI.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-25 08:04:47 -05:00
Kumar Gala 23bf9426ad drivers: serial: uart_fe310: Match Kconfig defines in comment
The trailing #endif comments used CONFIG_FE310_UART_{0,1} and they
should be CONFIG_UART_FE310_PORT_{0,1}.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-25 08:04:16 -05:00
Carles Cufi 6f534e4551 drivers: entropy: nrf5: Implement standard ISR-specific call
Implement the new entropy_get_entropy_isr() function to allow the kernel
to collect entropy before the scheduler and kernel data structures are
ready. Switch to an nrf-specific version for high-performance
requirements in the BLE Link Layer.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-05-24 15:13:13 -07:00
Ulf Magnusson 45221a9706 serial: nsim: Fix impossible-to-enable CONFIG_UART_NSIM
CONFIG_UART_NSIM depends on CONFIG_NSIM, which was removed in commit
9bc69a46fa ("boards: Update arc em_starterkit support from 2.2 to
2.3"). Remove the dependency, and also remove the CONFIG_NSIM=y setting
from the test_nsim test (which should now work).

Also change the condition for EXTERN()ing _VectorTable in
include/arch/arc/v2/linker.ld to check CONFIG_UART_NSIM instead of
CONFIG_NSIM. I'm guessing the EXTERN() is there to make the symbol
visible to nSIM, though I don't know anything about it.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-24 13:09:28 -04:00
Aurelien Jarno 80a9b02200 drivers: usb_dc_stm32: enable VDDUSB on STM32L4x2
The STM32L4x2 SoCs need to control the isolation of the USB features
from VDDUSB. This is done through the PWR_CR2 bit USV, however the
current code checks for the PWR_CR2_PVME1 bit instead, which is only
available on Cat. 3 devices. This bug is also present int the HAL and
likely copied from there.

Replace the check by PWR_CR2_USV instead.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-05-24 09:42:30 -05:00
Kumar Gala 8321b6b64f arch: arm: nxp: Fixup HAS_MCUX_RTC
When the RTC support get added we had a select on HAS_RTC, however this
Kconfig symbol didn't exist.  Clean this up to match the pattern of
HAS_MCUX_RTC.  The driver now depends on that and the SoC selects it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-24 08:21:24 -05:00
Erwan Gouriou 2bd15aa774 drivers: clock_control: stm32: Remove unsupported clock configuration
In stm32 clock_control driver, Kconfig symbol CLOCK_STM32_PLL_PREDIV1
in stm32f3 series was set as conditional on the activation of some
specific STM32F3 SoCs that are not supported yet in Zephyr.
Remove this flag.
In order not to loose a rather studious part of code, comment it out
and set a TODO to specify how to re-enable it once it will be
required.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-05-24 08:04:00 -04:00
Erwan Gouriou 134b74844e drivers: clock_control: remove reference unknown config flag
Leftover from STM32 clock_control driver introduction
Remove unkown symbol

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-05-24 08:04:00 -04:00
Johann Fischer 192833a828 drivers: usb_dc_kinetis: fix out-of-bounds write/read
Fix out-of-bounds write/read.

fixes: #7714
fixes: #7715
fixes: #7719
fixes: #7721
fixes: #7723
fixes: #7725
fixes: #7727
fixes: #7734
fixes: #7738

Coverity-ID: 186032
Coverity-ID: 186036
Coverity-ID: 186044
Coverity-ID: 186046
Coverity-ID: 186048
Coverity-ID: 186051
Coverity-ID: 186055
Coverity-ID: 186059
Coverity-ID: 186061

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-05-23 18:57:33 -04:00
Kumar Gala 1ea0331636 drivers: pinmux: Remove dead logic
There is no pinmux_dw.c and not Kconfig symbols associated with
CONFIG_PINMUX_DW, so remove the references to them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 17:57:06 -04:00
Kumar Gala 4a3f5e5c7d drivers: sensor: pms7003: Rename CONFIG_PMS7003_SERIAL_TIMEOUT
Rename CONFIG_PMS7003_SERIAL_TIMEOUT to CFG_PMS7003_SERIAL_TIMEOUT as it
was not exposed in Kconfig as a configurable option.  So don't use the
CONFIG_ prefix for non-Kconfig symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 17:57:06 -04:00
Kumar Gala 084386302f drivers: sensor: bmm150: Fix typo in Kconfig symbol
In the code we had an if defined based on
CONFIG_BMM150_MAGN_SAMPLING_RATE_RUNTIME that should have been
CONFIG_BMM150_SAMPLING_RATE_RUNTIME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 17:57:06 -04:00
Kumar Gala 682455ec89 drivers: crypto_ataes132a: Fix typo in Kconfig symbol
In the code we had an if defined based on
CONFIG_ATAES132A_I2C_SPEED_STANDARD that should be
CONFIG_CRYPTO_ATAES132A_I2C_SPEED_STANDARD.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 17:57:06 -04:00
David B. Kinder 44383a394b doc: fix misspellings in Kconfig files
Found some misspellings missed during normal reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-23 16:57:20 -04:00
Kumar Gala c9dd05b92d drivers: net: loopback: Fix setting of SYS_LOG_LEVEL
We had a typo in the Kconfig symbol that was being used to try and set
SYS_LOG_LEVEL.  It should be CONFIG_SYS_LOG_NET_LOOPBACK_LEVEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-23 09:48:29 -05:00
Leandro Pereira 30e558f333 devices: entropy: Initialize drivers during PRE_KERNEL_1 stage
To ensure that early code that requires entropy has the HWRNG devices
fully initialized, initialize them all during PRE_KERNEL_1 stage.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-05-22 15:59:25 -07:00
Savinay Dharmappa 6701d44967 dts: xtensa: Fix build error due to dts changes for ns16550 driver.
patch add clock frequency and interrupt property to uart
node in intel_s1000.dtsi. Include soc.h after types.h to
prevent build error.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-05-22 08:51:59 -04:00
Alberto Escolar Piedras a21a075c1d native: ethernet: fix k_sleep() wait time
The input of k_sleep was wrongly converted from ms to ticks.
Fixed.

Fixes: #7656

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-05-21 22:34:17 -04:00
Alexander Wachter e73637af24 boards: stm: Add CAN support for stm32f072b micro controller
This commit adds the can device to the stm32f072b device tree and pinmux

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-05-19 20:19:30 +02:00
Alexander Wachter 2976ac351d drivers: can: Add CAN driver support for STM32
This commit adds low level driver support for STM32 micro controllers.
It is tested on stm32f072b in loopback and normal mode.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-05-19 20:19:30 +02:00
Alexander Wachter d3101b1fa4 drivers: can: Add syscall handlers for CAN API
This commit adds generic syscall handlers for the CAN API

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-05-19 20:19:30 +02:00
Alexander Wachter 023e4518f2 drivers: can: Add Kconfig for CAN driver
This commit adds the Kconfig for generic CAN drivers.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-05-19 20:19:30 +02:00
Ulf Magnusson aa26289458 kconfig: Get rid of leading/trailing whitespace in prompts
Leading/trailing whitespace in prompts requires ugly workarounds in
genrest.py, as e.g. *prompt * is invalid RST. strip() all prompts in
Kconfiglib and get rid of the genrest.py workarounds. Add a warning too.

The Kconfiglib update has some unrelated cleanups and fixes (that won't
affect Zephyr).

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-19 09:26:39 +03:00
Armando Visconti c9262bb47f board: argonkey: add LSM6DSL configuration in Kconfig.defconfig
Use the named choices feature introduced by PR #6966
and configure LSM6DSL on ArgonKey board.
The two named choices introduced in LSM6DSL are:

    - LSM6DSL_BUS_TYPE (default LSM6DSL_I2C)
    - LSM6DSL_TRIGGER_MODE (default LSM6DSL_TRIGGER_NONE)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-18 13:10:33 -05:00
Armando Visconti 17c15ff182 boards: stm32: argonkey: Add dts support to sensors
This patch adds dts support to lps22hb/hts221/vl53l0x
I2C sensors as well as lsm6dsl SPI sensor.

Since some info, like gpio for irq triggering or SPI bus
characteristics, may be provided through dts, they need
to be made optional in the LSM6DSL driver by usage of
macros like HAS_DTS_SPI_PINS or HAS_DTS_SPI_DEVICE.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-18 13:10:33 -05:00
Jan Van Winkel ca16779d9e driver: ILI9340 LCD display driver
Minimal driver for ILI9340 LCD display driver including support
for adafruit 2.2" LCD display (1480)

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-05-18 20:21:45 +03:00
Tomasz Bursztyka 00bbbae41d drivers/serial: Add port 2 instance in ns16550 driver
Looks lik ARC arch snps_esmk can provide a 3rd port of this controller,
so let's add the necessary bits and pieces to get it instanciated if one
enable this port in DTS.

PCI settings are not introduced for that port as there is no known
arch/board exposing a 3rd port on PCI bus.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Tomasz Bursztyka 60d509f3d7 arch: Use dts to set i2c priorities for quark_se/quark_d2000
Fix the qmsi i2c driver and the relevant SoCs accordingly.
Also applying relevant changes on quark_se_c1000_ss as it can use i2c
qmsi driver as well along with qmsi ss i2c driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Tomasz Bursztyka ed26b95746 drivers/gpio: Removing dts generated options in QMSI Kconfig
Now that all arch using QMSI gpio driver are generating the right
settings through DTS, these options can be removed from Kconfig.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Tomasz Bursztyka bd9706cd9b arch/arc: Use dts to set gpio priorities for quark_se_c1000_ss
Fix the qmsi ss gpio driver accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Tomasz Bursztyka 61ef30d10e drivers/uart: Use dts to set uart options for ns16550 driver
Fix the ns16550 uart driver and relevant SoCs accordingly.
All generic settings are now DTS based.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Tomasz Bursztyka 17c6456678 drivers/uart: Use dts to set uart priorities for QMSI driver
Fix the qmsi uart driver and relevant SoCs accordingly.
Also: using config for irq everwhere relevantly and not an hardcoded
value in the driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Tomasz Bursztyka 250c4a87ed arch: Use dts to set rtc priorities for Intel quark, x86 and arc
Get the name generated through dts as well.
Fix the rtc driver and relevant SoCs accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Tomasz Bursztyka 53f91976b1 arch/x86: Use dts to set gpio options for quark_se and quark_d2000
Get the name and irq flags generated through dts as well.
Fix Kconfig for the gpio driver accordingly.

Irq priority is not set by dts for D2000 as it's irq controller does
not support it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-18 20:18:50 +03:00
Carles Cufi c4a62e0427 drivers: serial: nrf: Fix is_pending handling
In order to check whether an interrupt is pending for the driver user,
the driver itself needs to verify what interrupt paths are enabled (RX
and or TX) so that as not to return true misleadingly.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-05-18 13:30:49 +02:00
Andrew Boie 7e5b021b56 drivers: adc: fix TOCTOU attacks
The toplevel adc_seq_table is now copied onto the stack and
the stack copy used.

The contained entries array is now copied onto an allocation
drawn from the caller's resource pool, to prevent modification
of the buffer pointers.

The return value policy here is to oops the caller if bad memory
or objects are passed in, but return an error otherwise.

Based on an original patch by Leandro Pereira, rebased and the
copy of the entries array added.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 15:08:54 -07:00
Andrew Boie 375e8d73ce spi_handlers: fix some build issues
Needed string.h for memset, and the spi bufs are const.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 23:34:03 +03:00
Andrew Boie 8345e5ebf0 syscalls: remove policy from handler checks
The various macros to do checks in system call handlers all
implictly would generate a kernel oops if a check failed.
This is undesirable for a few reasons:

* System call handlers that acquire resources in the handler
  have no good recourse for cleanup if a check fails.
* In some cases we may want to propagate a return value back
  to the caller instead of just killing the calling thread,
  even though the base API doesn't do these checks.

These macros now all return a value, if nonzero is returned
the check failed. K_OOPS() now wraps these calls to generate
a kernel oops.

At the moment, the policy for all APIs has not changed. They
still all oops upon a failed check/

The macros now use the Z_ notation for private APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 23:34:03 +03:00
Stanislav Poboril 5477ee4531 mcux: Add MCUX IPM driver for lpc and kinetis socs
Add driver for MCUX mailbox which can be used for lpcxpresso54114
and other lpc and kinetis socs.

Origin: Original

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2018-05-17 15:07:48 -05:00
Maureen Helm 474a618f1b watchdog: Introduce mcux wdog shim driver
Adds a shim layer around the mcux kinetis wdog driver to adapt it to the
zephyr watchdog interface.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-17 15:00:55 -05:00
Maureen Helm 39d63d316b clock_control: Add support for getting LPO frequency in mcux sim driver
The mcux sim clock control driver was originally designed to pass
through the clock subsystem value from dts to the mcux CLOCK_GetFreq()
function. This assumed that the values in
include/dt-bindings/clock/kinetis_sim.h matched the enumeration in
fsl_clock.h, which is true for the coresys, platform, and bus clocks.
However, the low-power oscillator (LPO) clock has a different values in
k64 vs. kw2xd, therefore we must update the clock_control driver to
parse the value from dts and convert it to the fsl_clock.h enumeration.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-17 15:00:55 -05:00
Andy Gross 7b92d3fb1c rtc: nxp: Add RTC driver for NXP Kinetis
This patch adds the configuration, driver, and HAL changes required
to implement a MCUX based RTC driver for the NXP Kinetis KW41Z.

Signed-off-by: Andy Gross <agross@kernel.org>
2018-05-17 13:45:08 -05:00
Andy Gross 27bdb83308 rtc: Add prescalar configuration option
This patch adds a prescaler configuration option that denotes the
number of RTC ticks per second.  This is used to calculate the value
for 1 second.

Signed-off-by: Andy Gross <agross@kernel.org>
2018-05-17 13:45:08 -05:00
Andy Gross 4aaaccc739 rtc: Kconfig: Split off QMSI into separate Kconfig
This patch splits off the QMSI RTC into a separate Kconfig
file in preparation for adding more RTC drivers.

Signed-off-by: Andy Gross <agross@kernel.org>
2018-05-17 13:45:08 -05:00
Florian Vaussard 35cb2ba346 watchdog: stm32: fix style issue
Convert uint32_t to u32_t. Warning reported by checkpatch.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-05-17 13:09:09 -05:00
Florian Vaussard d0fa58722d watchdog: iwdg: honor IWDG_STM32_START_AT_BOOT
The Kconfig IWDG_STM32_START_AT_BOOT is actually not used and the
watchdog is enabled unconditionnally at init.

Enable the watchdog only if CONFIG_IWDG_STM32_START_AT_BOOT is set.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-05-17 13:09:09 -05:00
Florian Vaussard 70fdb7f2ef pinmux: stm32l4: add I2C4 pinmux on PD12/PD13
Pins PD12 and PD13 can be multiplexed as I2C4. Add the necessary
defines.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-05-17 13:08:36 -05:00
Florian Vaussard af601c22e6 i2c: stm32: add support for I2C4
Add the necessary Kconfigs and supporting code to enable I2C4 which can
be found on certain STM32L4.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-05-17 13:08:36 -05:00
Florian Vaussard e681f9cbeb pwm: stm32: fix off-by-one on PWM period
TimerHandle->Init.Period is used to initialize TIMx ARR register. The
timer will count from 0 up to ARR including, thus it will tick
(ARR + 1) timers per period. As the "period_cycles" variable holds the
number of desired ticks, the ARR register is computed as

ARR = period_cycles - 1

Update the code to reflect this relationship. Otherwise the timer will
count one more tick for each period, leading to a wrong PWM frequency.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-05-17 13:07:43 -05:00
Tomasz Bursztyka 50990cdfaf drivers/ieee802154: KW41Z drivers is missing hw ACK caps
ACK frames are handled on hardware level, so let's expose this
capability in order to avoid L2 waiting for these.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 16:18:53 +03:00
Tomasz Bursztyka 49bd1e9c6f ieee802154: Add support for filtering source short/ieee addresses
L2 could take advantage of such hardware capability, when supported by
the device. This is also required for OpenThread.

Fixes #5714

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 16:18:53 +03:00
Johann Fischer 06840af1cc drivers: usb: kinetis: fixup endpoint config, stall and read
This patch fixes some bugs found during testing with testusb from
linux kernel.

An unresolved issue is that the stack is not fast enough
to stall (if necessary) the control endpoint during Setup Stage.
This might require a API change so that the usb device stack
can explicit allow the driver to resume token processing.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-05-17 07:00:49 -05:00
Johann Fischer 5dc6f99cfd drivers: usb: add usb device driver for Kinetis USBFSOTG Controller
Add usb device driver for Kinetis USBFSOTG Controller.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-05-17 07:00:49 -05:00
Tomasz Bursztyka ce947431e2 drivers/wifi: Move all winc1500 related code to its own directory
There will be other drivers, and mixing up all these files together will
create a mess so better having a dedicated place for winc1500, at least.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 2145503273 drivers/winc1500: Implement wifi mgmt offloaded API
Scan, connect and disconnect for now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 5f9ccad97f drivers/wifi: Switch info level to debug level in winc1500 driver
These output are fine while debugging, but useless otherwise.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 569e70aaae drivers/wifi: Split case logic into functions in winc1500 driver
This cleans up the callback functions and isolate each part to a
relevant handler to improve readability.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 1e4ba8231d drivers/wifi: Remove useless gpio configuration call in winc1500 driver
This call is already made in nm_bus_wrapper along with SPI.
In nm_bus_wrapper however: moving the call out of #ifdefsf as it is
generic call, whatever bus would be choosen.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 8e65f6ab2a drivers/wifi: Let's go away from SPI legacy API in WINC1500
As legacy API is meant to be removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 0294c67349 drivers/wifi: Move configure macros to Kconfig
There is no point having undocumented and local config options when
Kconfig can be used to expose these relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 2a1d222adc drivers/wifi: Generalize GPIO configuration for the WINC1500 driver
Previous way was cumbersome (based on an old way for cc2520 actually),
so moving towards the more recent and proper way.

This will enable anybody to actually provide gpio configuration for a
winc1500 out of any board specific location.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Dario Pennisi 9bdf1cdb0e drivers/wifi: Add winc1500 WiFi driver
Adding support for WINC1500 WiFi chip.

It introduces the wifi drivers sub-directory.

It provides a Full-MAC for 802.11 and an offloaded network stack as
well. The driver uses Atmel's winc1500 HAL.

Signed-off-by: Dario Pennisi <dario@iptronix.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Massimiliano Agneni <massimiliano.agneni@iptronix.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka cd580e0bba drivers/adc: Uneven buffers will lead to buffer overflow
TI's ADC108S102 is a sampling on 16 bits, and thus requires the
destination buffer to be made of an even number of bytes.

Fixes #7389

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:30:29 +03:00
Alberto Escolar Piedras 29ed87c930 native: entropy: warn of security risk
Be more obvious about the entropy_native_posix driver
being only a test utility which does not generate real
entropy.

Fixes: #6388

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-05-17 07:51:00 +03:00
Leandro Pereira 845ac3ef46 drivers: spi: Fix TOCTOU while transceiving SPI messages
To avoid another thread from modifying the spi_buf_set and spi_config
structures passed to the spi_transceive() syscall, copy those to the
kernel stack before validating.

Fixes #7378.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-05-17 07:45:15 +03:00
Leandro Pereira ab16853b26 drivers: crypto: crypto_mtls_shim: Set output length for all operations
The out_len member in struct cipher_pkt was not set.

Fixes #4684.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-05-16 23:30:11 +03:00
Leandro Pereira e61c48123c drivers: crypto: crypto_tc_shim: Set output length for all operations
The out_len member in struct cipher_pkt was not set.

Fixes #4684.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-05-16 23:30:11 +03:00
Thiago Silveira 05c45e359a drivers: serial: Fix race condition in nRF5 UART TX
Fix a somewhat rare race condition when the thread gets
preempted in the middle of sending a byte through UART.

If the other thread also sends another byte through UART
and "consumes" the EVENTS_TXDRDY value, the first thread
will get stuck in the while loop forever.

By moving the reset to the function start, we guarantee that
the baseline state of EVENTS_TXRDY is 1. Therefore, the first
thread will continue normally when it executes again.

Signed-off-by: Thiago Silveira <thiago@exati.com.br>
2018-05-16 18:10:03 +02:00
Vinayak Kariappa Chettimada e2393a002e drivers: timer: nRFx: Remove redundant code
Remove redundant declaration of youve_print. This probably
had been a review oversight and upstreamed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-05-16 10:16:29 +02:00
Erwan Gouriou 49d820866c drivers/dma: dma_stm32f4x: check stream id boundaries
Check that stream Id passed to stm32 DMA API is within
possible stream values and return -EINVAL is invalid stream
id is passed.

fixes: #7380


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-05-15 15:48:55 -05:00
Yannis Damigos 82c0b8cba1 drivers/bluetooth/hci: Name the choice of BT HCI driver bus
Name the choice of BT HCI driver bus in order to config it
in the board's Kconfig.defconfig file.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-15 15:11:12 -05:00
Kumar Gala 7de55a07fc pwm: stm32: Fix type for PMW3 support
When we called DEVICE_AND_API_INIT for PMW3, we accidently had
pwm_stm32_2 instead of pwm_stm32_3.

Fixes: #6625

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-15 14:48:44 -05:00
Adithya Baglody b0db28b512 drivers: Cmake: Add __ZEPHYR_SUPERVISOR__ macro for driver files.
Normally a syscall would check the current privilege level and then
decide to go to _impl_<syscall> directly or go through a
_handler_<syscall>.
__ZEPHYR_SUPERVISOR__ is a compiler optimization flag which will
make all the system calls from the driver files directly link
to the _impl_<syscall>. Thereby reducing the overhead of checking the
privileges.

In the previous implementation all the source files would be compiled
by zephyr_source() rule. This means that zephyr_* is a catchall CMake
library for source files that can be built purely with the include
paths, defines, and other compiler flags that all zephyr source
files uses. This states that adding one extra compiler flag for only
one complete directory would fail.
This limitation can be overcome by using zephyr_libray* APIs. This
creates a library for the required directories and it also supports
directory level properties.
Hence we use zephyr_library* to create a new library with
macro _ZEPHYR_SUPERVISOR_ for the optimization.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-15 17:48:18 +03:00
Wayne Ren 532e4d22ee dts: optimize and bug fixes the dts of em_starterkit
* add gpio, i2c, spi definitions
* optimize and bug fix the dts.fixup
* optimize and bug fix the em_starterkit related definitions
  in dts folder

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-05-15 09:48:11 +02:00
Wayne Ren 3f24975514 drivers: spi: fix the bug of slave selection in spi_dw
According to data sheet of dw_spi, ser reg is used to
select spi device/slave.

one bit in ser maps to one spi device/slave, i.e..
cs 0 ---> bit 0
cs 1 ---> bit 1
cs 2 ---> bit 2

the original code has a bug. the config->slave cannot
directly be written into ser. It should be mapped to
the correct bits through 1 << config->slave.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-05-14 17:23:03 -04:00
Karol Lasończyk 30a24e8ad0 drivers: watchdog: Add shim for nrfx WDT driver
Changes add a translation layer to make nrfx WDT driver works
with Zephyr API.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-05-14 10:28:23 -05:00
Michał Kruszewski 0c2ef4ea3d drivers: watchdog: Watchdog API redesign
New API enables setting watchdog timeout in the unit of microseconds.
It is possible to configure watchdog timer behavior in CPU sleep state
as well as when it is halted by the debugger.
It supports watchdogs with multiple reload channels.

Jira: ZEP-2564

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-05-14 10:28:23 -05:00
Yannis Damigos aec465968c drivers/usb_dc_stm32: Check if SYSCFG is enabled
Add a check to raise an error if SYSCFG is disabled,
before doing the pin remaping for F0 SoCs on QFN28
and TSSOP20 packages.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-14 09:45:40 -05:00
Yannis Damigos 87d624419d drivers/stm32f0x_ll_clock: Enable SYSCFG in clock_control
Enable System Configuration Controller clock in clock_control
instead of gpio controller when we set a gpio as interrupt.
We use System Configuration Controller to manage external
interrupts and enable PIN pair PA11/12, used in USB device,
mapped instead of PA9/10.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-14 09:45:40 -05:00
Yannis Damigos f6a9697923 drivers/stm32l0x_ll_clock: Enable SYSCFG in clock_control
Enable System Configuration Controller clock in clock_control
instead of gpio controller when we set a gpio as interrupt.
We use System Configuration Controller to manage external
interrupts and internal voltage reference for 48 MHz HSI
used in USB device.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-14 09:33:29 -05:00
Yannis Damigos c9d5b56140 drivers/usb_dc_stm32: HSI48 requires VREFINT in L0
In STM32L0 series, HSI48 requires VREFINT and its buffer
with 48 MHz RC to be enabled. This patch enables
VREFINT reference for HSI48 oscillator.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-14 09:33:29 -05:00
Yannis Damigos 2a55fcf607 drivers/usb/usb_dc_stm32: Provide EP_TYPE_* defines for L0
USB LL API provides the EP_TYPE_* defines. STM32Cube does not
provide USB LL API for STM32L0 family. Map EP_TYPE_* defines
to PCD_EP_TYPE_* defines.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-14 09:33:29 -05:00
Yannis Damigos c0b472132c dts/arm/st: Add USB support for stm32l072/73
Add USB support for stm32l072 and stm32l073 SoCs

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-14 09:33:29 -05:00
Andy Gross 3ff4065cb3 drivers: sensors: lsm6dsl: Fix array overrun
This patch fixes an overrun detected via Coverity.  The
lsm6dsl_odr_to_freq_val function takes an index as argument.  If the
index is out of bounds, the expected behavior was to return the last
element of an array.  The actual behavior was to overrun the array.

Fixes: #7482

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-05-11 19:04:06 -04:00
Yannis Damigos f47b9c2fca drivers/usb/device: Remove USB DISCONNECT gpio options
Remove USB DISCONNECT gpio options from Kconfig.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-11 16:53:12 -04:00
Maureen Helm 0d1beb2f9e boards: dts: Add mcr20a bindings and fix networking samples
Adds dts bindings for the mcr20a wireless transceiver. The frdm_k64f
board supports the mcr20a via an Arduino shield, therefore the dts node
is added to the board dts. The kw2xd is a SiP and thus the mcr20a dts
node is added to the soc dts.

The networking samples using prj_frdm_k64f_mcr20a.conf have been broken
since the refactoring of the mcux gpio driver to dts in commit
4e8f29f319. The sample is now fixed.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Maureen Helm 2fbb4d35d2 spi: Refactor mcux dspi shim driver to use clock control interface
Refactors the mcux dspi shim driver to use the clock control interface
instead of calling CLOCK_GetFreq() directly. With this change, we are
now getting all soc-specific information from device tree and can remove
the direct dependency on soc.h.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Maureen Helm cae9074492 spi: Refactor mcux dspi driver to use dts
Get the driver name, base address, irq number, and irq priority from
dts.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Maureen Helm d749feb698 spi: Fix missing "depends on !HAS_DTS_SPI"
Spi configs like irq priority and device name should not exist if the
spi driver supports device tree. Fixes a few configs that were missing
the necessary "depends on !HAS_DTS_SPI".

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Maureen Helm 3fbc7c5853 spi: Wrap instance configs consistently with ifdefs
Some spi instance configs were wrapped with ifdefs, while others used
depends. Make them consistent by wrapping them all with ifdefs.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Maureen Helm 9cd36c7bd2 boards: dts: Add fxas21002 interrupt bindings and fix sensor sample
Adds dts bindings for the fxas21002 interrupt pins to all boards that
have this sensor.

The fxas21002 driver is currently only aware of one sensor interrupt
pin, therefore the routing of INT1 or INT2 to the driver is handled in
each board's dts.fixup.

The fxas21002 sample application has been broken since the refactoring
of the mcux gpio driver to dts in commit
4e8f29f319. The sample is now fixed.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Maureen Helm 90ac25f736 boards: dts: Add fxos8700 interrupt bindings and fix sensor sample
Adds dts bindings for the fxos8700 interrupt pins to all boards that
have this sensor. The frdm_k64f and hexiwear_k64 connect both sensor
interrupt pins to the mcu, but the frdm_kw41z connects only one.

The fxos8700 driver is currently only aware of one sensor interrupt pin,
therefore the routing of INT1 or INT2 to the driver is handled in each
board's dts.fixup.

The fxos8700 sample application has been broken since the refactoring of
the mcux gpio driver to dts in commit
4e8f29f319. The sample is now fixed.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-10 15:43:42 -05:00
Kumar Gala 57904102fd gpio: dts: Introduce Kconfig symbols to convey GPIO dts support
Add a set of Kconfig symbols that allow us to set that the GPIO
driver/SoC support DTS (HAS_DTS_GPIO) and that drivers that need/use
GPIO support DTS as well (HAS_DTS_GPIO_DEVICE).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-10 15:43:42 -05:00
Erwan Gouriou 00376f08ca dts/bindings: Add reset and irq gpios to "st,spbtle-rf" yaml
In order to generate GPIO definition for control pin of BlueNRG module
define reset-gpio and irq-gpio in st,spbtle-rf yaml binding.

Add HAS_DTS_SPI_PINS kconfig symbol to control use of the '#define'

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-05-10 14:21:16 -05:00
Yannis Damigos 3bbe87e171 dts/arm/st: Add usbotg_fs node to stm32l4 DT
Add otgfs (USB) node to stm32l4.dtsi.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-10 07:47:13 -05:00
Pushpal Sidhu e2b27d820d drivers: usb_dc_stm32: enable VDDUSB if needed
This is required on boards that isolate VDDUSB from the system.

Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
2018-05-10 07:47:13 -05:00
Pushpal Sidhu b1478518c0 drivers: usb_dc_stm32: use HSI48 if available
This clock was designed to power crystal-less usb if available.

Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
2018-05-10 07:47:13 -05:00
Pushpal Sidhu ad530033c1 drivers: pinmux_stm32l4x: add usb otg pinmux
Add OTG_FS alt modes for STM32L4

Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
2018-05-10 07:47:13 -05:00
Yannis Damigos 47fe4ee78b dts/arm/st: Add USB support for stm32f070/72
Add USB support for stm32f072 and stm32f070 SoCs

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-10 07:47:13 -05:00
Yannis Damigos 80d69ea47f boards: stm32f3_disco: Add USB support
Add USB support to STM32F3DISCOVERY board

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-10 07:47:13 -05:00
Yannis Damigos 38d2567e08 boards: olimexino_stm32: Add USB support
Add USB support to OLIMEXINO-STM32 board

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-10 07:47:13 -05:00
Yannis Damigos 55dada2592 drivers: usb_dc_stm32: Add usb disconnect pin support
Add usb disconnect pin support.
Some boards use a GPIO pin to controll a transistor,
which drives the pull-up resistor on USB DP pin.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-05-10 07:47:13 -05:00
Yannis Damigos 921bfeb05a drivers: usb_dc_stm32: Add support for all STM32 families
Add support for all STM32 families

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-05-10 07:47:13 -05:00
Armando Visconti 77c0456d00 sensors: hts221: Fix a crash due to bad device init
The hts221 requires 2.2 ms at boot time to download
the flash content into the volatile mem and the
calibration values cannot be read before that.

This issue is causing following crash:

  ***** USAGE FAULT *****
    Executing thread ID (thread): 0x20000234
    Faulting instruction address:  0x80037de
    Division by zero
  Fatal fault in essential thread! Spinning...

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-09 15:15:50 -05:00
David B. Kinder 3e136b4d23 doc: fix misspellings in doc and Kconfig files
Fix misspellings missed during regular PR reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-09 15:06:43 -05:00
Armando Visconti b83d0782c9 sensor: vl53l0x: make xshut pin control optional
The XSHUT pin, used to shutdown the device when it is not
in current use, is optional and some boards (like ArgonKey)
leave it tied to vdd. So, the driver must provide a way to
make this part configurable.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-05-09 13:18:58 -04:00
Ulf Magnusson 547ed9b563 kconfig: Make 'source' non-globbing and use 'gsource'
Until now, Zephyr has used a patched Kconfiglib that turns 'source' into
a globbing source (by replacing 'source' with 'gsource' at the token
level). There's two problems with this:

  - The patch needs to be maintained separately

  - Misspelled filenames are silently ignored, as they look like glob
    patterns that don't match anything

Fix it as follows:

  1. Replace all 'source' statements that use wildcards with 'gsource'

  2. Remove the custom Kconfiglib patch so that 'source' no longer globs

The sed pattern '/source.*[*?]/s/source/gsource/' was run over all
Kconfig* files to do the replacement.

source's that use environment variables that might contain glob patterns
were manually changed to gsource.

Building the docs in doc/ is a good test, as doc/Makefile deliberately
sets the environment variables to glob up as many Kconfig files as
possible.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-05-08 11:14:12 +02:00
Andrew Boie 5dc2ab4f47 ti_adc108s102: validate num_entries
num_entries can be as large as 255. However, based on the
_ti_adc108s102 implementation, num_entries must be less than
ADC108S102_CMD_BUFFER_SIZE or the cmd_buffer[] and
sampling_buffer[] arrays in the data struct could overflow.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-07 22:27:28 -04:00
Andrew Boie 97ccf99b9b ti_adc108s102: fix verification off-by-one
Channel IDs start at 0, need to fail if the provided ID
equals ADC108S102_CHANNELS, not just larger than it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-07 22:27:28 -04:00
Andrew Boie a0c3aadde4 uart_qmsi: fix possible divide-by-zero
The line control value could result in a baud divisor of zero.
Check this condition and return -EINVAL if that is the case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-07 22:25:48 -04:00
Andrew Boie a4208365f2 pinmux: remove user mode access
The pinmux subsystem does not have any API documenation. Currently
none of the existing pinmux drivers do any kind of input validation
for the pin/op parameters, which has been shown to allow the caller
to access unauthorized memory, up to and including disabling the
MPU.

This requires a proper specification for the pinmux subsystem and
also modification of existingd drivers to validate arguments on a per
driver basis. Remove user mode access until #7390 is resolved.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-07 22:20:20 -04:00
Manivannan Sadhasivam 26babfc622 drivers: led: Add system call handler support
Add system call handler support to LED subsystem. No buffers are
involved in any of the API's and hence the syscall support is
straightforward.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-05-04 10:07:39 -07:00
Ramakrishna Pallala 15447fa1d8 drivers: dma: Add dma driver for Nios-II MSGDMA core
Add dma driver for Nios-II Modular Scatter-Gather DMA soft IP.

This driver relies upon the Altera HAL msgdma driver for all
the dma core register programming and interrupt handling.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-05-03 10:38:09 -04:00
Stanislav Poboril 67ba7d8a36 gpio: Add imx gpio driver shim
Adds a shim layer around the imx gpio driver to adapt it to the Zephyr
gpio interface.

For now only the port 4 was tested.

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2018-05-02 12:48:14 -05:00
Maureen Helm c6f2b4ccb8 spi: Fix mcux dspi driver to parse lsb transfer mode correctly
The mcux dspi driver was incorrectly using the macro SPI_MODE_GET() to
parse the operation for SPI_TRANSFER_LSB. The effect of this bug was
that the driver would quietly always operate in SPI_TRANSFER_MSB mode.

Coverity-CID: 185401

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-02 10:59:11 -04:00
Andrei Emeltchenko 943ca29d4b usb: dw: Fix Coverity issue with get_mps()
Fix issue with Coverity using if / else instead of switch, though it
does not affect code.

Fixes: #7257
CID: 185399

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-05-02 09:26:44 -04:00
Matthias Boesl f618af75a8 driver: ieee802154: cc1200: fix context handling
context was missed during refactoring

Signed-off-by: Matthias Boesl <matthias.boesl@gmail.com>
2018-05-02 14:30:34 +03:00
Savinay Dharmappa 5060f4bd14 driver: usb: enable usb2.0 on intel_s1000
Change-Id: I59091c465e84f1d6ba64433b7320182d83ff9589
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Rajavardhan Gundi 5b6f02442b drivers: i2s: introduce CAVS I2S
Implements the driver for Intel CAVS I2S. Only Playback
is currently supported.

Change-Id: I7b816f9736dc35e79a81d3664d6405dc0aac15b4
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Rajavardhan Gundi bd0d5133e4 drivers: dma: introduce Intel CAVS DMA
Introduce the Intel CAVS DMA. This is based out of the DesignWare
DMA IP but the register offset and bits have been changed in some
cases. However, the fundamental definition for the register field
has not been changed. Hence the registers begin with "DW_" to
indicate the Designware origin.

This driver currently supports the single block mode and linked list
multi-block mode. Scatter-Gather is not supported.

Change-Id: I33a8ed5141d9236167de50e14d3d407e95d6f553
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Rajavardhan Gundi dadf9e7a81 xtensa: intel_s1000: implement interrupt mechanism
intel_s1000 has multiple levels of interrupts consisting of core, CAVS
Logic and designware interrupt controller. This patchset modifies
the regular gen_isr mechanism to support these multiple levels.

Change-Id: I0450666d4e601dfbc8cadc9c9d8100afb61a214c
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Rajavardhan Gundi e3f2fa4f89 drivers: interrupts: introduce Designware interrupt controller
This interrupt controller is a designware IP that combines several
sources of interrupt into one line that is then routed to the parent
controller.

This implementation supports only the regular irqs with no support
for priority filtering and vectored interrupts. Firqs are also not
supported.

Change-Id: I8bdf6f8df4632b6d7e8a3ba9a77116771d034a48
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Rajavardhan Gundi 74016bb64c drivers: interrupts: introduce CAVS interrupt logic
CAVS interrupt logic is an intel IP that combines several sources of
interrupt into one line that is then routed to the parent controller.
CAVS stands for "connected Audio, Voice and Speech". This IP supports
4 lines which can have a max of 32 interrupts each.

Change-Id: Ia6be51428bedf1011d148ae1fc5d4c34252c05da
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Armando Visconti f7f56ccda5 drivers: sensor: lsm6dsl: add .attr_set callback
In order to be able to change at runtime the Output Data
Rate (ODR) as well as the Full-Scale (FS) for both the
Accelerometr and Gyroscope the driver needs to provide
the .attr_set callback.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-30 16:16:08 -05:00
Armando Visconti 580a9b3f2f drivers: sensor: lsm6dsl: Fix typos
In .h there are few typos that are fixed in this commit:

  - Delete LSM6DSL_REG_CTRL3_C and LSM6DSL_REG_CTRL9_XL
    register sections duplication.
  - Fix LSM6DSL_REG_CTRL6_C address.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-30 16:16:08 -05:00
Armando Visconti 180b139786 drivers: sensor: lsm6dsl: Adding sensorhub support
Adding sensorhub support. Only one slave device can be selected
among LIS2MDL (magnetometer) and LPS22HB (pressure and temperature).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-30 16:16:08 -05:00
Tomasz Bursztyka f4ad698847 drivers/spi: Remove DW spi slave test left over
This reset to 0 was used for testing threshold on slave mode.

Coverity-CID: 185402

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-30 08:07:06 -04:00
Manivannan Sadhasivam bb394bbafb drivers: led: Add LED driver support for TI LP3943
Add support for Texas Instruments LP3943 - 16 channel LED driver.
Supported blinking period: 0 to 1600ms
Supported brightness value: 0 to 100%

This driver supports the following APIs:

1. led_blink
2. led_set_brightness
3. led_on
4. led_off

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-04-27 10:46:53 -05:00
Manivannan Sadhasivam 94bba071d6 drivers: led: Add public API for LED drivers
Add support for LED APIs for controlling the LED devices. This
API can be used by the LED devices present on the chip and connected
externally via buses like I2C, SPI etc...

Following APIs are currently supported:

1. led_blink
2. led_set_brightness
3. led_on
4. led_off

Driver support using these APIs will be added in subsequent patches.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-04-27 10:46:53 -05:00
Leandro Pereira c200367b68 drivers: Perform a runtime check if a driver is capable of an operation
Driver APIs might not implement all operations, making it possible for
a user thread to get the kernel to execute a function at 0x00000000.

Perform runtime checks in all the driver handlers, checking if they're
capable of performing the requested operation.

Fixes #6907.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-26 02:57:12 +05:30
Leandro Pereira 25fb83c6e0 drivers: i2c: Fix TOCTOU while transferring I2C messages
All the mesages are checked with _SYSCALL_MEMORY() prior to calling the
actual implementation function.  However, a race condition might happen
between the check and the call to _impl_i2c_transfer() itself.

Copy the msgs vector to a locally allocated array and pass it to the
transfer implementation.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-24 18:30:00 -07:00
Erwan Gouriou d8ba007a8b drivers: clock_control: Add MSI as possible clock source for stm32
Add MSI as potential SYSCLK direct source for L0 and L4.
It could be needed in some cases when an accurate clock
is required and no external clock is available.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-04-24 08:55:02 -05:00
Håkon Øye Amundsen c26fdc1b55 drivers/spi: Fixed incorrect prompt.
The prompt for SPI1 IRQ priority stated SPI0 incorrectly.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2018-04-24 08:23:30 -05:00
Maureen Helm 57e80e5345 ext: mcux: Reorganize imported drivers into soc family subfolders
We have been combining imported mcux drivers into a flattened directory
structure to maximize driver reuse, but the introduction of additional
nxp soc families (lpc and imx) to zephyr has introduced driver naming
conflicts. This caused us to rename and modify imported files, such as
fsl_gpio.c/h, to make them unique across all three nxp soc families.
This makes updating the the mcux drivers complicated, especially for the
lpc family.

Reoganize the mcux drivers into soc family subfolders, so we can just
copy all the drivers from an mcux distribution (which is done on an
soc-basis) into the appropriate soc family folder. Undo all of the
naming changes that occurred when lpc and imx drivers were originally
imported. Undo the accidental squashing of the kinetis watchdog and dcdc
drivers that occurred when the imx drivers were introduced.

The drawback to this approach is that we have duplicate files when the
same hw ip modules exist in multiple soc families, however there are
only few cases where this occurs, such as fsl_lpuart and fsl_trng.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-04-24 07:55:48 -05:00
Michael Hope 8f7e5bd0a5 uart_pipe: re-work the RX function to match the API and work with USB.
include/uart.h says that an interrupt may be an edge or a level.
Re-work the uart_pipe interrupt handler to support both.  This makes
uart_pipe work with the USB CDC ACM driver.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-04-21 08:37:54 -07:00
Tomasz Bursztyka a09a0b2c49 sensors/lsm5dsl: Fix SPI API usage
The driver was not moved to the recent SPI API changes.

Fixes #7009

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-21 05:42:59 -07:00
Andrei Emeltchenko 8d3b2fa8a9 usb: usb_dc_dw: Fix incorrect MPS return
Because of incorrectly set MPS we always got 0 returned for WRITE
transfers and ZLP were always generated for every packet.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-04-20 21:03:33 -07:00
Maureen Helm 4e8f29f319 gpio: Refactor the mcux gpio driver to use dts
Get the driver name, base address, irq number, and irq priority from
dts.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-04-20 08:54:11 -05:00
Andrzej Głąbek 5991cea137 drivers: spi: Add missing periods in Kconfig.nrfx
Quite a few sentences in help descriptions and comments were not ended
with periods.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-13 17:04:16 +02:00
Andrzej Głąbek ecd081115a drivers: spi: Add shim for nrfx SPIS driver
This adds a translation layer to make the nrfx driver for the nRF SPIS
(SPI Slave with EasyDMA) peripheral accessible via the Zephyr's API.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-13 17:04:16 +02:00
Tomasz Bursztyka ffb2bcbb4d drivers/spi: Slave async calls require recv frames as successful status
Synchronous call return them on success, asynchronous one - with proper
signal - require to get this info through the status.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-13 16:02:03 +02:00
Tomasz Bursztyka 1143606ce9 drivers/spi: Fix context lock behavior
- removing a left over from previous SPI slave attempt
- unlock async calls on error

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-13 16:02:03 +02:00
David B. Kinder 5e9f7cb27a doc: fix misspellings in Kconfig files
occasional spelling-check scan found some misspellings

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-04-13 08:28:57 -04:00
Andrzej Głąbek 5976afe91f drivers: spi: Correct a typo in spi_nrfx_spi.c
Introduced with the commit 7a9c4cbd9d,
by copy-pasting from "spi_nrfx_spim.c". Shame on me...

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-13 10:26:28 +02:00
Henrik Brix Andersen 8c5b16cc79 drivers: flash: atmel sam0: Fix compilation without page layout support
The sam0 flash driver has support for retrieving flash page layout
information.  This commit fixes compilation when
CONFIG_FLASH_PAGE_LAYOUT is disabled.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-04-12 17:26:54 -05:00
Andrzej Głąbek 7a9c4cbd9d drivers: spi: Align nrfx_spi shim with the nrfx_spim one
Similar parts of code are aligned in the two shims, so that they
can be easily compared and updated if required.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-12 14:19:53 -04:00
Andrzej Głąbek 998c79d09b drivers: spi: Add shim for nrfx SPIM driver
This adds a translation layer to make the nrfx driver for the nRF SPIM
(SPI Master with EasyDMA) peripheral accessible via the Zephyr's API.
The shim is provided only for nRF52840 because of a hardware anomaly
present in nRF52832. See Anomaly 58 (SPIM: An additional byte is clocked
out when RXD.MAXCNT = 1) in Errata for this chip.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-12 14:19:53 -04:00
Andrzej Głąbek ea1d14e529 hal: nordic: Move nrfx IRQ related stuff from SPI shim to nrfx_glue
The simple function that helps to integrate nrfx IRQ handlers with
the IRQ_CONNECT macro can be used in shims for various nrfx drivers,
not only the SPI one.
Similarly, the macro for getting the IRQ number from the peripheral
base address needs to be widely available. It should be even moved
to <nrfx_common.h> in some next nrfx update.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-12 14:19:53 -04:00
Tomasz Bursztyka eab3f168fd net/mgmt/wifi: Add dedicated net mgmt hooks for WiFi offload devices
Exposing connect, disconnect and scan for now.

In case the iface is an instance of a WiFi offload device, the way it
manages scanning, connecting and disconnecting will be specific to that
device (not the mgmt interface obviously). In such case the device will
have to export relevantly a dedicated bunch of function to serve the
mgmt interface in a generic way.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-12 09:56:07 -04:00
Tomasz Bursztyka 8b839b4e0c drivers/wifi: Add files skeleton for adding WiFi drivers
This will help not to collide within drivers implementations and/or
avoid dependency from one driver to another one.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-12 09:56:07 -04:00
David Leach 51a2090780 newlib: Fix compiler warning when using Newlib
- There is a mismatch when interfacing with external code where a
  uint32_t is defined as a parameter and internal Zephyr code attempts
  to use u32_t. If NewLib is used, the typedef for u32_t is
  'unsigned int' which is not a portable match to uint32_t as
  'unsigned int' is not a common size across architectures so gcc will
  output a warning.
- The mcux flash code calls NXP supplied functions that expect a
  uint32_t.
- openthread.c ot_state_changed_handler has a uint32_t flag as a
  parameter.

Signed-off-by: David Leach <david.leach@nxp.com>
2018-04-11 16:57:12 +03:00
David Leach 9f7470e240 drivers: ieee802154: Add OpenThread modifications to KW41Z driver
- Add modifications to the KW41Z driver to enable operation with
  OpenThread L2 layer.

Signed-off-by: David Leach <david.leach@nxp.com>
2018-04-11 16:57:12 +03:00
David Leach 7738a501d9 drivers: ieee802154: Add auto-ack support to KW41Z driver
- Enabled and fixed auto-ack offload support for 802.15.4 transmit

Signed-off-by: David Leach <david.leach@nxp.com>
2018-04-11 16:57:12 +03:00
Jukka Rissanen 3e048f6d3e drivers: eth: native_posix: Add ethernet statistics support
Collect ethernet statistics for this driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-11 16:49:48 +03:00
Tomasz Bursztyka e8bc063215 drivers/ethernet: Reduce runtime context size in ENC28J60 driver
- tx_tsv is never used anywhere
- and rx_rsv can be allocated on stack

Optimizing a bit the stack usage in eth_enc28j60_rx() function as well.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-11 16:28:16 +03:00
Tomasz Bursztyka 669d4a8ccb drivers/ethernet: Optimize memory read/write operations in ENC28J60
SPI API helps to directly transfer bytes from/to relevant buffers, so
let's take advantage of it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-11 16:28:16 +03:00
Tomasz Bursztyka 42902e580b drivers/ethernet: Fix and clean a bit ENC28J60 driver
Driver is still a bit messy, not using for instance the 0-copy
capabilities of SPI API, but this will be fix later.

Constify most of the spi buf structures, removing useless variables,
renaming function with common prefix eth_enc28j60_ etc...

It seems to fix an issue on verifying if tx was successful as well.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-11 16:28:16 +03:00
Diego Sueiro 346165b2e8 serial: Add imx uart driver shim
Adds a shim layer around the imx uart driver to adapt it to the Zephyr
serial interface.

Modem mode was introduce to control it as DCE and DTE and can be
configured in the device tree:
    modem-mode:
        type: int
        category: required
        description: Set the UART Port to modem mode 0 (dce) 1 (dte)
        generation: define

For now only the UART 2 was tested.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-04-11 08:27:05 +02:00
Armando Visconti 6fb326ce06 drivers: sensor: lsm6dsl: add trigger support
Add DATA_READY trigger support to ST LSM6DSL driver.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-10 22:12:14 +02:00
Tomasz Bursztyka 4bf1a9bd60 net/ethernet: All types are prefixed with ethernet_
Aligning eth_hw_caps to the right prefix, so ethernet_hw_caps.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-10 14:45:37 +03:00
Tomasz Bursztyka e996b37c0a net/ethernet: Add capabilities exposed by device drivers
Curently only link speed is exposed.
Opportunity taken to remove any post-fix enumerating the iface init
and/or the api: these must be generic and used by all the instances.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-10 14:45:37 +03:00
Aapo Vienamo 8e1cf7b619 gpio: nrf5: Make the init priority configurable
A Kconfig option is added for setting the initialization priority.

This is done to make the initialization priority requirements in
nrf52_pca20020 board power up sequence clearer.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-04-09 17:09:06 -05:00
Aapo Vienamo fbd3c2f4e2 sensors: ccs811: Deassert the reset pin with GPIO
The driver releases the sensor from reset in case the reset pin is
driven by a GPIO.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-04-09 17:09:06 -05:00
Ioannis Glaropoulos 8d2b22cd05 drivers: timer: expose RTC1 ISR handler function
This commit exposes the RTC1 ISR handling function, so the
function can be directly used in tests which generate
customized vector tables manually and require a visible symbol
for the ISR function.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-04-08 08:47:36 -04:00
Jukka Rissanen ed923da435 drivers: net: mcux: Use VLAN priority to set RX packet priority
Set the received network packet priority according to VLAN priority.
Currently this mapping is 1:1 but can be changed if needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-05 08:54:19 -04:00
Jukka Rissanen 2c343d2b25 drivers: net: slip: Add VLAN support
This enables VLAN support in slip tap ethernet driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-05 08:54:19 -04:00
Jukka Rissanen 73b43e0024 drivers: eth: native_posix: Add VLAN support
Support also virtual LAN (VLAN) with native_posix ethernet driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-05 08:54:19 -04:00
Jukka Rissanen 02ee3651ed drivers: eth: gmac: Adding VLAN support to Atmel E70 board
This enables VLAN support in gmac ethernet driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-05 08:54:19 -04:00
Jukka Rissanen 7385e38802 drivers: eth: mcux: Enabling VLAN
This enables / fixes VLAN support in mcux ethernet driver.

The commit contains these changes for enabling VLAN:
* Increase the size of the ethernet frame if VLAN is enabled.
* Enable VLAN in chip if VLAN is enabled
* If VLAN is enabled, then the iface in context struct should
  not be used directly as there can be multiple VLAN iface
  related to this physical device.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-05 08:54:19 -04:00
Carles Cufi aaa9cf2edd drivers: entropy: nrf5: Clarify Kconfig options
Clarify the difference between the buffer length and threshold Kconfig
options available in the nRF5 entropy driver.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-04-05 08:09:57 -04:00
Sebastian Bøe 5165876164 doc: Add a comment describing the algorithm used by entropy_nrf5.c
Improve the documentation of entropy_nrf5.c by adding a comment that
clarifies it's characteristics.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-04-05 13:10:49 +02:00
Tomasz Bursztyka 011ad6f7db drivers/spi: Fix tmod update on DW driver
Logical or is unsufficent for setting up new tmod: it's required to
remove previous one first. Indeed, 0 as tmod is valid (tx-rx mode), but
previous tmod could be 10 or 01, so a logical or will keep the previous
tmod leading to a bogus transaction.

Fixing also a rebase issue visible when debug mode is enabled. Slave
callback is a left over from a test on spi slave.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-05 12:04:56 +03:00
Leandro Pereira 42a96c5667 drivers: clock_control: quark_se: Fix "make menuconfig"
Commit 29f8b23b broke "make menuconfig" due to a missing newline in
this Kconfig.quark_se file.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-04 20:31:02 -04:00
Marti Bolivar bdd03f388b drivers: sensor: temp_nrf5: fix sensor type
The sensor channel type for the nRF TEMP peripheral is incorrectly set
to SENSOR_CHAN_AMBIENT_TEMP. This peripheral measures die temperature,
not ambient temperature.

Fix the sensor channel.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-04-04 12:29:05 -05:00
Tomasz Bursztyka f1ae94027a api/spi: Slave transactions will return received frames on success
Unlike master mode which will always return 0 on success.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 3f4cffc302 spi: Remove SPI legacy API
No drivers nor samples are using it anymore.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 13dba12b9a drivers/spi: Remove legacy NRF5 master and slave drivers
As legacy SPI API is being removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka d5e6874d64 drivers/ieee802154: No need of semaphore for spi in mcr20a
SPI API is reentrant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka b702236d1a drivers/ethernet: No need of semaphore for spi in enc28j60
SPI API is reentrant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 1086fdf1f4 drivers/spi: spi_context lock makes transceive function reentrant in DW
No need to check on busy bit from hardware.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 79308dd1a8 drivers/spi: Simplify how error is forwarded from ISR handler in DW
No need to test it twice then in completed().

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 841a420709 drivers/spi: Add slave mode support to the DesignWare driver
It involves a minor change on which register is configured.
Most of the change is with threshold handling.
Handling the Kconfig based supported mode per-port.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Andrzej Głąbek 00397c65bc drivers: spi: Add shim for nrfx SPI driver
This adds a translation layer to make the nrfx driver for the legacy
(i.e. without EasyDMA) nRF SPI peripheral accessible via the updated
Zephyr's API of the SPI driver.
Configuration files are already prepared for adding support for SPIM
(Master with EasyDMA) and SPIS (Slave with EasyDMA) peripherals.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 09dd5e9b22 drivers/spi: Remove legacy API support from mcux dspi driver
Now that MCR20A supports the new API, legacy support from mcux dspi
driver can be safely removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka b62b12eef8 drivers/ieee802154: Switch MCR20A driver to new SPI API
And adding support for GPIO CS as well.
It looks like the driver could benefit from centralizing all SPI access
into a unique function, the protocol does not seem too convoluted to do
so, like CC2520 or CC1200.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Maureen Helm ef5152ab22 spi: Implement new spi api in the mcux dspi driver
Adds support for the new spi api to the mcux dspi shim driver. Does not
remove support for the legacy spi api since there are still consumers of
that api, particularly the mcr20a 802.15.4 driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 65f6c96736 drivers/spi: Switch Intel driver to new SPI API
Ditch any legacy API support altogether.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 0a43cac3bb drivers/spi: Removing QMSI driver as it does not support new API
Native DW driver is relevantly used instead.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka dc49d0f361 drivers/spi: Fix typo on parameters type in DW arc regs definitions
s/u32_s/u32t obviously

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka a863494463 drivers/spi: Enable port 3 and 4 on DW driver
This will be useful on Quark_SE ARC core which can access x86 core SPI
controller.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 29f8b23bfd drivers/clock_control: Enable ARC core support on quark_se driver
Clock control can also be done through the ARC core.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 423f0095c7 drivers/spi: Specify options per-port on DW driver
Generalize clock control. Make interrupt policy per-port.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 44d4de5105 drivers/spi: Remove legacy DesignWare SPI driver
Nothing requires this driver anymore.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 57a1f7b4f1 drivers/spi: Add support for TX or RX only modes on DW driver
As for RX only, computing the NDF will be used for EEPROM mode.
Only a way to determine EEPROM mode is missing.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Matthias Boesl 2a14d289e5 drivers/ethernet: Switch enc28j60 to new SPI API
Let's use the new SPI API and ditch the old one.

Signed-off-by: Matthias Boesl <matthias.boesl@gmail.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 659f0f2d20 api/spi: Add the possibility to request CS active high logic
Some device may need to be put up on CS high logic. The active low logic
is the default as usual, but it is now possible to request the active
high logic.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 29a68cd7a5 drivers/spi: Adapt Kconfig and generic context to enable slave support
Adding Kconfig options to set supported modes by the controller
(master, slave or both)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 3219817d4a drivers/bluetooth: Get rid completely of legacy SPI API in SPI HCI
No need to support legacy API there.
The special usage of CS in BlueNRG is centralized it dedicated functions
to avoid all the #ifdefs everywher.
Also managing transaction error.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 595340ab8a drivers/bluetooth: Switch SPI based HCI driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka d620c16a0d drivers/adc: Switch ti_adc108s102 driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 2f7e6b6d42 drivers/sensors: Switch lis2dh driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 94d7c9f23e drivers/sensors: Switch adxl362 driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka eb7af5527d drivers/sensors: Switch bmi160 driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 244c2af154 drivers/sensors: Switch bme280 driver to new SPI API
Replacing legacy API calls by news ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 16cb7ab883 drivers/flash: Switch W25QXXDV driver to new SPI API
This saves quite some memory.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka d4065ae73e drivers/ieee802154: Switch CC2520 to new SPI API
Finally switching to new SPI API. It makes code simpler and performs
better.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka f44ba8e7d4 api/spi: Make cs attribute in struct spi_config constant
Content is never modified by any driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka da42c0077c api/spi: Add a dedicated Kconfig option for asynchronous mode enablement
Instead of using CONFIG_POLL, which is not directly related to SPI and
is a kernel option, let's have SPI_ASYNC instead. When enabled, it will
select POLL automatically.

Fixes #5839

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka ea2431f32f api/spi: Reduce parameter number on transceive function
tx_bufs/tx_count and rx_bufs/rx_count can be hold in another dedicated
structure, thus reducing the number of parameters to transceive. This
permits to avoid using the stack when calling transceive.

Since we saved parameters, we can expose back the struct device pointer,
to stay consistent with other device driver APIs.

Fixes #5839

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka f3f9fab20e api/spi: Make spi_config parameter constant
As the content of this struct will not be modified by drivers, it's
better to pass it as constant. Also, if someday struct device can be
made contant too, this change will make spi ready for registering the
spi_config into ROM directly.

Fixes #5839

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 324265420b api/spi: Disable legacy API by default
Let's start deprecation work of the SPI legacy API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka d89e8e6a79 drivers/spi: Cleanup the Kconfig files
Split QMSI relevant part into its own file. Some config where using
prompt, some not: normalizing it by removing the prompt keyword where
relevant.

Reducing the file by using if/endif when relevant.

However, it still not fully clean default: cfg and default baudrate
should disappear. There is no default configuration to apply as long
as the controller is not configured to run from any part using spi API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Armando Visconti 87d6c50e47 sensors: Add separation between ambient and die temperature
Some device include a temperature sensor, usually used as a
companion for helping in drift compensation, that measure the
die temperature. This temperature IS NOT related to the the
ambient temperature, hence a clean separation between the two
is required.

This commit introduces a clean separation between the two
types of temperature leaving the old deprecated definition
still there.

The list of current drivers that read the die (and not the ambient)
temperature is the following:

 - adxl362
 - bma280
 - bmg160
 - bmi160
 - fxos8700
 - lis3mdl
 - lsm6ds0
 - lsm6dsl
 - lsm9ds0
 - mpu6050

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-03 22:29:11 -04:00
Jukka Rissanen 22399c327e drivers: eth: native_posix: Enable ethernet by default if needed
As the native_posix board has ethernet driver, then enable it by
default if networking is enabled in prj.conf file. This way we can
use generic networking config file when running the application
for native_posix board.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-03 17:47:53 -04:00
Armando Visconti 902c629eac drivers: sensor: lsm6dsl: add SPI support
Add SPI bus support to LSM6DSL sensor. The bus routines (i.e. I2C
and SPI) are defined in separate files, where proper r/w callbacks
are registered.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-04-03 15:59:36 -04:00
Ulf Magnusson af1ad986b9 drivers: spi: Format SYS_LOG_SPI_LEVEL help nicer
The previous help text rendered as a single paragraph in the Kconfig RST
reference. The new help text renders as a bullet list and matches the
format of SYS_LOG_CRYPTO_LEVEL.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-29 14:25:24 -04:00
Ulf Magnusson 93689bdc80 kconfig: Remove no-op selects of choice symbols
Selecting a choice symbol is always a no-op, and the latest version of
Kconfiglib prints a warning. This commit removes all selects of choice
symbols, which might make the Kconfig files a bit clearer and gets rid
of the warnings.

This is just a dumb removal. I did not try to guess the intent of each
select.

Fixes #6849

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-29 08:57:39 -04:00
Tobias Aschenbrenner e99fb77620 sensors: lis3dh: Fix i2c burst read
The sensor enables the readout of multiple consecutive registers if
the MSb of the sub-address is set. The other 7bit are the register
address.

Signed-off-by: Tobias Aschenbrenner <taschenb@posteo.de>
2018-03-28 10:42:34 -04:00
Michael Hope 5a6271b08d usb: sam0: add the new usb_dc_ep_mps() function.
This was added as part of the USB transfer infrastructure.  Implement
for the SAM0.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-03-27 19:57:38 -04:00
Peter Gielda 1c60ba1459 drivers: serial: Add missing FE310 UART driver reference to CMakeLists
This commit adds a missing reference to uart_fe310.c to CMakeLists.txt.

Signed-off-by: Peter Gielda <pgielda@antmicro.com>
2018-03-27 19:52:28 -04:00
Jukka Rissanen 47dafffb67 net: if: Separate IP address configuration from net_if
Move IP address settings from net_if to separate structs.
This is needed for VLAN support.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-27 10:06:54 -04:00
Andrzej Głąbek ad24576501 usb: device: nrf5: Remove support for the ACCESSFAULT event
This event is no longer exposed for the USBD peripheral,
and the newest MDK version (and consequently new nrfx HAL)
does not contain its definition and related bitfields.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-03-27 09:35:21 -04:00
Anas Nashif 788aa45888 drivers: timer: remove unkown jira ID
Remove RTOS-2676 from the comment, this is a jira issue number that was
used with zephyr in the past and not available anywhere for reference.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-26 13:13:04 -04:00
Jukka Rissanen 5afa30ccef drivers: eth: native_posix: No need to sleep in select
We can just use polling mode with 0 timeout when waiting data
to arrive from host OS. The 50ms timeout is not needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-26 15:47:48 +03:00
Vinayak Kariappa Chettimada 91a27358bd drivers: gpio: nrf5: Use popcount and first_lsb_set functions
Use the Zephyr toolchain and architecture defined popcount
and first_lsb_set functions instead of GCC specific
functions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-03-23 16:40:58 +01:00
Vinayak Kariappa Chettimada 89cb10f151 drivers: gpio: nrf5: Add support for port P1 in nRF52840 SoC
Added support for GPIO Port P1 in nRF52840 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-03-23 16:40:58 +01:00
Vinayak Kariappa Chettimada e9fa157245 drivers: gpio: nRF5: Use lowest IRQ priority level as default
Fix the permitted range of IRQ priority to, 0 to 2, as
maximum one priority level is used, for zero latency IRQs
in nRF51, being an ARM Cortex-M0.

Update the Kconfig default GPIOTE IRQ priority level to the
lowest, for nRF51 a level of 2; for nRF52, a level of 5.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-03-23 16:40:58 +01:00
Kumar Gala 8a824356e0 arch: arc: em{7,9,11}d: Add initial DTS UART support
Add support for getting some basic params from the DTS for the UART.
The ns16550 driver still needs to be updated to get IRQ and address
info from DTS.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-23 10:13:53 +01:00
Jukka Rissanen 85a2459edb net: Support network packet checksum calc offloading
Create infrastructure that allows ethernet device driver to tell
if it supports network packet checksum offloading. This applies only
to IPv4, UDP or TCP checksums. The driver can enable/disable checksum
offloading separately for Tx and Rx network packets.

If the device (ethernet in this case) can calculate the network
packet checksum for IPv4, UDP or TCP, then do not calculate the
corresponding checksum by the stack itself.

Fixes #2987

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-23 08:37:01 +02:00
Tomasz Bursztyka 74d1835505 drivers/i2c: Make QMSI SS driver IRQs set via CONFIG_ options
Now that dts i2 qmsi ss nodes generate the right options, let's use
them. Apply the relevant fixup on the targeted SoC.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-03-23 10:42:33 +08:00
Tomasz Bursztyka 7af98f5e67 drivers/i2c: Use standard bitrate settings for QMSI SS driver
Apply the change on relevant arch/boards.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-03-23 10:42:33 +08:00
Tomasz Bursztyka 9b77741d63 drivers/i2c: Use standard bitrate settings for QMSI driver
Apply the change on relevant arch/boards.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-03-23 10:42:33 +08:00
Tomasz Bursztyka 8f891ba702 drivers/i2c: Use standard bitrate settings for DW driver
Applying the change to relevant arch/boards, either in their Kconfig or
the dts specific files.

Taking the opportunity in dw driver to rename the variable the same way
as they are everywhere else in the code (s/dev/dw and s/port/dev) in
init function.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-03-23 10:42:33 +08:00
Tomasz Bursztyka ae18040109 drivers/i2c: Removing useless configuration attribute in DW driver
Probably a left over form legacy interrupt handling.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-03-23 10:42:33 +08:00
Tomasz Bursztyka 860d40f94e drivers/i2c: Disable some QMSI SS option when HAS_DTS_I2C is enabled
These options will be generated through DTS.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-03-23 10:42:33 +08:00
Tomasz Bursztyka 6d247b5c2b drivers/i2c: Rename generic configure option in DW drivers
And adapt SoC's information relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-03-23 10:42:33 +08:00
Tomasz Bursztyka d506da2879 drivers/i2c: Indent sources the same way everywhere
Using tabs only.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-03-23 10:42:33 +08:00
Tomasz Bursztyka d95fa65270 drivers/i2c: Cleanup Kconfig
Move driver specific to dedicated file when relevant (i.e.: more than
1-2 options), use if/endif also.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-03-23 10:42:33 +08:00
Ilya Tagunov 08418a210d drivers: uart: stm32: improve STM32L0 support
STM32L0 UARTs are named as STM32F0 ones, but their
clocking is like all other families.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-03-21 15:40:55 -04:00
Ilya Tagunov 84cffc7f29 drivers: uart: stm32: make comments and options less specific
Replace specific STM32F1 references with generic STM32 ones.
Use generic names like U(S)ARTx for instances which have different
naming across STM32 families.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-03-21 15:40:55 -04:00
Alberto Escolar Piedras 474a56b806 entropy: nrf5x remove unnecessary header
Remove unnecessary header inclusion in nordic's nrf5 random
driver which added a dependency to ext/hal/nordic.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-03-21 15:35:42 -04:00
Carles Cufi 8aa9a37902 drivers: flash: nrf: Rename nrf5 to nrf
With upcoming ICs that are not in the nRF5x family, rename the flash
driver and all its dependencies from nrf5 to nrf.

Should also fix the issue introduced by f49150cab6 which broke the
assignment of the flash device due to a partial rename.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 20:07:09 +01:00
Jukka Rissanen 8b8178b0f9 drivers: eth: gmac: Do not verify config for unit tests
No need to verify that the configuration is proper if we are
compiling the driver for unit test and not going to ever run
the test.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-20 10:37:34 -04:00
Carles Cufi 6656969598 arch: arm: nordic_nrf: Restore copyright years
A previous commit had mistakenly overwritten the copyright years instead
of extending the range. Fix this mistake so that the proper range is
recorded.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 13:25:44 +01:00
Carles Cufi b2016da563 arch: arm: nrf: Rename common header to apply to all nRFx ICs
The existing nrf5_common.h now applies to other Nordic ICs that are not
part of the "5" family. Instead rename this to nrf_common.h to cover the
upcoming ICs that belong to other families.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 11:57:14 +01:00
Carles Cufi f49150cab6 arch: arm: nrf: Rename nrf5 SoC Family to nrf
Upcoming Nordic ICs that share many of the peripherals and architecture
with the currently supported nRF5x ones are no longer part of the nRF5
family. In order to accomodate that, rename the SoC family from nrf5 to
nrf, so that it can contain all of the members of the wider Nordic
family.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 11:57:14 +01:00
Jukka Rissanen 0f66426f4a drivers: eth: Add ethernet driver for native posix arch
This creates zeth network interface in your host and allows user
to send and receive data sent to this network interface.

Fixes #6007

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-18 20:47:36 -04:00
Jukka Rissanen b047f816f4 net: Create helper to convert MAC strings to array of bytes
As following commits need this functionality, create a function
which converts "01:02:ab:fe:34:dd" type hex strings to array of
bytes. Change the SLIP driver to use this new function.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-18 20:47:36 -04:00
Ilya Tagunov 48a5fbcaa9 drivers: flash: stm32f0: remove CONFIG_FLASH_PAGE_SIZE
STM32F0 flash driver already uses FLASH_PAGE_SIZE from HAL
in flash layout part, so CONFIG_FLASH_PAGE_SIZE is redundant
and confusing.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-03-18 17:02:53 -04:00
Sundar Subramaniyan 120ddbc089 drivers: usb: nrf5: Fix ISO IN/OUT SOF handling
For ISOOUT transaction, check if the buffer is empty before starting
the DMA and for ISOIN case check if the buffer is available to start
the DMA for IN transaction. This handling was swapped. So, handle it
accordingly.

Signed-off-by: Sundar Subramaniyan <sundar.subramaniyan@gmail.com>
2018-03-17 18:58:06 +01:00
Sundar Subramaniyan cfdaa1dcaf drivers: usb: nrf5: Fix cdc_acm OUT endpoint read size issue
Problem:
cdc_acm sample outputs junk characters to the console when any key
is pressed. It is supposed to echo the same character as the input.

Analysis:
nRF52840 USB driver always reads 64 bytes from the USB peripheral's
local buffer irrespective of the data length. Even when 1 byte
is sent by the host, the usb driver receives as 64 bytes.

Since the maximum packet size value had been used when setting up
the EasyDMA's MAXCNT register for OUT transactions, DMA transffered
the entire 64 bytes of it's local buffer into the data RAM
irrespective of the OUT data length, containing garbage at the end
of useful payload. For some applications like hci_usb the extra
bytes were being ignored. But for cdc_acm, the entire 64 bytes
is getting echoed back displaying garbled characters on the terminal.

Fix:
For OUT endpoints, the amount of data received by USBD to its local
buffer should be read using SIZE.EPOUT[x] registers in the case of
BULK and INTERRUPT endpoints and SIZE.ISOOUT register for ISOOUT
endpoint. This value should be set to the EasyDMA maxcnt register
to DMA into RAM buffer. Fix this issue for Bulk, Interrupt and
ISOOUT endpoints.

Signed-off-by: Sundar Subramaniyan <sundar.subramaniyan@gmail.com>
2018-03-17 18:58:06 +01:00
Sundar Subramaniyan 9a195e36cd drivers: usb: nrf5: Add usb_dc_ep_mps function
This function is now required and used by usb_transfer APIs.

Signed-off-by: Sundar Subramaniyan <sundar.subramaniyan@gmail.com>
2018-03-17 18:58:06 +01:00
Loic Poulain e7fa746b0c usb: dc_dw: Do not clear RX NAK at init for transfer endpoints
Reading is managed by transfer API.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-03-16 14:45:24 -07:00
Loic Poulain 5beb183879 usb: dc_dw: Fix FIFO available space
For now tx-fifo sizes are not configured (cf usb_dw_set_fifo).
Default fifo size is 136 bytes and sending more than 136 bytes
makes the data split into incorrect chunk size.
This patch prevents this by reducing available fifo size to a
multiple of the endpoint max packet size.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-03-16 14:45:24 -07:00
Loic Poulain 9d1957fae1 usb_dc: Add usb_dc_ep_mps function
This function returns endpoint max packet size (mps).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-03-16 14:45:24 -07:00
Loic Poulain 10923173a6 Revert "usb: stm32: Introduce transfer method"
This reverts commit b23d599682.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-03-16 14:45:24 -07:00
Michael Hope bb9d516787 spi: sam0: fix CS and back-to-back transfers.
Fixes #6577.

Wait for all ongoing transmits to complete before de-asserting CS.

When doing a tx then rx, wait for the previous tx to complete before
flushing the rx buffer.

Tested on the Arduino Zero against a Olimex MOD-NRF24L module.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-03-15 11:09:55 -05:00
Ilya Tagunov 00c0520247 arch: arm: soc: stm32l0: add I2C support
Add SPI support for STM32L0 series.
L0 SPI peripheral requires SCK pin speed workaround
to function properly.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-03-15 10:53:26 -05:00
Jukka Rissanen ead9cd409c net: websocket: Add console support
Add console driver that allows console session to be transferred
over a websocket connection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-15 15:17:36 +02:00
Sundar Subramaniyan 380a25018d drivers: usbd_nrf5: Add nRF52840 USB Device Controller Driver
* Add USB device controller driver for nRF52840 SoC.
* Supports only Bulk and Interrupt endpoints for now.
* ISO endpoint support is WIP.

What's tested:
* BTUSB - LE Scanning and connection.

Known issues in btusb tests:
 * Observed momentary delays during LE scanning. This is possibly
due to hci_usb's way of calling the usb_write().

 * Sometimes, when LE scan stop command is issued, response is not
sent and as a result USB stops functioning. This is also related
to the way btusb is handling the write(). For some reason, the
btusb class handler seems to issue another data packet write before
the USB control transaction is complete.

Miscellaneous:
* Lots of TODO items to discuss and fix.

Origin: Original

Signed-off-by: Sundar Subramaniyan <sundar.subramaniyan@gmail.com>
2018-03-15 12:39:53 +01:00
Sundar Subramaniyan 49ed4fb276 clock_control: nrf5: Add USBD power event support for USB enumeration
nRF52840 USBD requires power events to start USB enumeration.

Add APIs to enable/disable the power events, read the USB VBUS detect
and output power ready statuses which can then be used by the USB driver
in the enumeration sequence.

Signed-off-by: Sundar Subramaniyan <sundar.subramaniyan@gmail.com>
2018-03-15 12:39:53 +01:00
Carles Cufi fb3387a490 Bluetooth: Remove rand driver and use entropy instead
After porting the rand driver to drivers/entropy, replace the usage of
the old, Buetooth-specific driver with the generic entropy one.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-03-14 16:47:50 +01:00
Carles Cufi 813b41beec drivers: entropy: Port the LL rand driver to entropy
The rand driver present in the BLE Link Layer is able to provide
entropy for both threads and ISRs, and so it is more suited to be used
as a generic nRF5x entropy driver instead of the current one. This will
allow applications and the Link Layer to use the same driver without
duplicating it.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-03-14 16:47:50 +01:00
Ilya Tagunov 9ae3fdc2ef arch: arm: soc: stm32l0: add I2C support
Add I2C support for STM32L0 series. LL-based driver
was already in place, so I've just enable it.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-03-14 09:02:25 -05:00
Aapo Vienamo dd9719bf46 gpio: Add a driver for SX1509B
Adds a driver for SX1509B I2C GPIO chip. This driver only supports the
basic GPIO features and does not currently implement the LED driver and
keypad matrix features.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-03-13 12:31:16 -05:00
Aapo Vienamo 422bc240b4 soc: nrf5: Use i2c configure options generated from dts
SoC dts fixups are added and the i2c_nrf5 driver is modified to use
the values generated from the device tree.

The I2C_*_DEFAULT_CFG and I2C_*_IRQ_PRI options are removed from board
defconfigs. Bitrate and IRQ priority are configured using using the
device tree instead.

HAS_DTS_I2C is selected on all nrf5 boards to prevent generation of
conflicting defines from Kconfig.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-03-13 14:14:13 +01:00
Savinay Dharmappa 8d7da51827 drivers: usb: device: code cleanup
include clk.h only for system that use QMSI.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-03-12 09:02:03 -04:00
Justin Watson aa7c91d0c2 driver: usart: Added support for interrupt driver USART on SAM E70.
Added interrupt support in the USART SAM serial driver.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-03-10 11:42:25 -06:00
Justin Watson b9c65e1882 drivers: GPIO Added GPIO for SAM family.
Added GPIO driver for SAM family of SoCs.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-03-10 11:42:25 -06:00
Endre Karlson baae89f27b driver: pinmux: Add pinmux driver for stm32l0x
Add driver header files for the stm32l0x pinmux

Signed-off-by: Endre Karlson <endre.karlson@gmail.com>
2018-03-10 11:42:25 -06:00
Endre Karlson 8e401e505e driver: interrupt_controller: Add support for stm32l0x
Add kconfig and c code for stm32l0x interrupt controller driver

Signed-off-by: Endre Karlson <endre.karlson@gmail.com>
2018-03-10 11:42:25 -06:00
Endre Karlson ef1d32b8ef drivers: gpio: Provide GPIO driver for stm32l0x
Add necessary GPIO defines for the stm32l0x series soc

Signed-off-by: Endre Karlson <endre.karlson@gmail.com>
2018-03-10 11:42:25 -06:00
Endre Karlson e99a79a9b1 drivers: clock_control: Provide support for stm32l0x
Add Clock Control support for the stm32l0x based on reference manuals

Signed-off-by: Endre Karlson <endre.karlson@gmail.com>
2018-03-10 11:42:25 -06:00
Armando Visconti 12b5ef0e06 drivers: pinmux: stm32f4: Added configuration macro for I2C2 on PB9
Added configuration macro for I2C2 multiplexing on PB9.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-03-10 11:42:25 -06:00
Michael Hope a8a36a23fc spi: sam0: use Device Tree for configuration.
Switch the SoC device tree to define a single entry per SERCOM instead
of one per mode.

Define a Device Tree binding for the SAM0 SPI and use it instead of
Kconfig for enabling / disabaling instances

Switch the Arduino Zero, Adafruit Feather M0 Basic Proto, and
Trinket M0 to use the new defintion.

Add the APA102 LED that's on the Trinket as a test.

Signed-off-by: Michael Hope <mlhx@google.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-10 11:42:25 -06:00
Michael Hope c83f0782b6 gpio: sam0: add pull up/pull down support.
Also trim back the headers.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-03-10 11:42:25 -06:00
Michael Hope f2651d0cc7 usb: sam0: add a USB device driver.
Implements a USB device driver for the SAM0 series.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-03-10 08:41:39 -05:00
Sahaj Sarup 069fce7289 boards: uart: Add UART6 for 96b_carbon
Enabled UART 6 on pin PC6 and PC7 for 96b_carbon

Signed-off-by: Sahaj Sarup <sahaj.sarup@linaro.org>
2018-03-08 13:58:28 -06:00
Andrzej Puzdrowski c788f84f25 drivers: flash: move FLASH_HAS_PAGE_LAYOUT Kconfig from arch
Keyword FLASH_HAS_PAGE_LAYOUT is related to flash and should
be declared in its Kconfig.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-03-08 10:18:57 +01:00
Andrzej Puzdrowski 80a99fa450 subsys: storage: flash_map: enable only if any flash driver is enable
It was possible to have enable flash module while no flash driver
implementation was enabled. This cause coverity issues and unnecessary
initialization call.

This pat introduce FLASH_HAS_DRIVER_ENABLED Kconfig keyword which is
selected once any flash driver is enabled. flash_map switch its
dependency to this keyword.


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-03-08 10:18:57 +01:00
Kumar Gala 4cd0fd2496 drivers: sensor: lsm6ds0: Fix assert logical error
The assert for what chan can be was missing several cases.

Coverity-CID: 182594
Fixes: 5888

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-06 15:21:43 -05:00
Ramakrishna Pallala 43d323ee9e drivers: flash: Fix Nios-II QSPI flash Coverity issue
Fix Coverity "Memory - corruptions (ARRAY_VS_SINGLETON)"
issue by type casting word_to_write to u8_t pointer and
adding a length check before memcpy operation.

Coverity CID: 182779

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-06 10:36:39 -08:00
Aapo Vienamo 0a6f8c1aa2 drivers: sensor: ccs811: Fix value conversion
The arithmetic performed on the CO2 and VOC measurements is pointless as
the units of the sensor already match those of the API, furthermore the
multiplication will overflow the u32_t with CO2 or VOC readings greater
than 4294 ppm or ppb. This CO2 concentration is achievable by breathing
at the sensor.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-03-05 13:23:38 -06:00
Aapo Vienamo 3318f21196 sensors: css811: Use HAS_DTS_I2C_DEVICE in Kconfig
A condition is added to the Kconfig file to disable config options which
will be supplied from the dts.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-03-05 11:22:47 -06:00
Johan Hedberg 9639c00fbb drivers: led_strip: Add driver for software-based WS2812B operation
This driver uses a bit-banging based technique of generating a signal
for the WS2812B LED strip. Since bit-banging is very timing sensitive,
where each CPU cycle counts, the driver uses inline assembly to
perform the most critical operataions. This initial version of the
driver only supports a Cortex-M0 implementation, and can e.g. be used
with the ZIP Halo LED strip for the BBC microbit:

https://www.kitronik.co.uk/5625-zip-halo-for-the-bbc-microbit.html

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-03-03 20:46:53 +01:00
Aapo Vienamo 1cf09e86ed drivers: i2c: nrf5: Make the driver thread-safe
Locking is added to externally callable API functions.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-03-03 20:41:37 +01:00
Philémon Jaermann 82b7433144 drivers: sensors: Enable LSM6DS0 GYRO sampling rate
Use correct sensor dependence in Kconfig
to enable GYRO sampling rate configuration.

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
2018-03-02 10:14:03 -06:00
Michael Hope 445988cd82 slip: fix a bug when in non-TAP mode.
ll_reserve only exists when SLIP is compiled with TAP support.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-03-02 07:28:07 +01:00
Vitor Massaru Iha fbaddfb079 drivers: pwm: Add PWM LED driver for ESP32
This is a initial support for PWM LED controller on ESP32.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-23 13:13:12 -05:00
Holman Greenhand 400dc79326 timer: cortex_m: Fix the discontinuous readings of the cycle counter.
On a stm32, When we use the k_busy_wait function to wait a
delay (500us) just after an idle tickless period the delay could be
lower than the requested one. Consecutive readings of the cycle counter
made with the function k_cycle_get_32 juste after tickeless period
provides erroneous values (value jump) after some time (100 us).

To fix this issue we needs:

- Add the update of clock_accumulated_count value in the
_timer_idle_exit function.

- Treat the case in the get_elapsed_count function when the reload value
of the timer is set to a remaining value to wait until end of tick (see
_timer_idle_exit) . In this case the time elapsed until the systick
timer restart was not yet added to clock_accumulated_count. To retrieve
a correct cycle count we must therefore consider the number of cycle
since current tick period start and not only the cycle number since the
timer restart.

Fixes #6164

Signed-off-by: Holman Greenhand <greenhandholman@gmail.com>
2018-02-23 08:58:23 -06:00
Alberto Escolar Piedras 30ae79ae39 native: added entropy device
Added pseudorandom entropy device for the native_posix board

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-23 07:34:07 -05:00
Ruslan Mstoi ca94b86b3d drivers: console: Fix crash in shell
Shell crashes when enter is pressed. This commit reverts relevant
changes from 14735116d1 that cause
this issue.

Fixes #6322

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2018-02-22 15:29:08 -05:00
Justin Watson c1ce290d45 serial: sam: add support for interrupt driven serial
Implements interrupt driven UART for the serial driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Justin Watson <jwatson5@gmail.com>
2018-02-21 11:26:20 -06:00
Yannis Damigos 899ed91506 drivers: usb_dc_stm32: Get USB configuration from DT
Use defines generated from DT.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-21 09:17:12 -06:00
Sean Nyekjaer d9b105fff5 serial: sam0: add samd20 support
There are some minor differences between the UART om SAMD20 and SAMD21
that we need to take into account:

SYNCBUSY bit for the samd20 is located in the STATUS reg.

The samd20 does not have a SAMPR bit like the samd21.

Signed-off-by: Sean Nyekjaer <sean@nyekjaer.dk>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-02-21 08:07:09 -06:00
Christopher Collins 14735116d1 subsys: mgmt: UART transport for SMP (mcumgr).
Add a UART driver dedicated to transporting mcumgr SMP requests and
responses.

Signed-off-by: Christopher Collins <ccollins@apache.org>
2018-02-20 22:07:52 +01:00
Tomasz Bursztyka c628146eba drivers/pinmux: Provide common SPI1/SPI2 configuration on stm32f0
Other variants exist.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-02-20 12:26:12 -06:00
Jukka Rissanen 10ef346aed drivers: net: loopback: Fix possible double unref
If we could not send the packet, then do not release the net_pkt
as that will be released in net_if.c:net_if_tx() if driver send()
fails.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-02-20 15:28:23 +02:00
Pedro Martucci ede5b8ffc3 drivers/ieee802154: Add hw filtering support for upipe driver
Implements HW filtering for IEEE802.15.4 UART Pipe driver.

Signed-off-by: Pedro Martucci <pedropaulomartucci@gmail.com>
2018-02-20 14:47:14 +02:00
Vitor Massaru Iha e84d1a4f31 drivers: gpio: Nios-II: Fix condition on gpio_nios2_config_oput_port()
(flags & GPIO_DIR_IN) is always zero because GPIO_DIR_IN is 0, then
we have to use GPIO_DIR_MASK.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-19 20:49:20 -05:00
Leandro Pereira 25a59cded9 drivers: sensor: vl53l0x: Use proper variable type for return code
VL53L0X_PerformSingleRangingMeasurement() returns a signed 8-bit
integer, not an unsigned 8-bit integer, making the "< 0" comparison
worthless.

Coverity-CID: 182593
Coverity-CID: 182597
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-02-17 09:19:35 -05:00
Giuliano Franchetto 8e534f7bf4 uart: fixing pin range being too tight for the nrf52840
The nrf52840 has 2 gpio ports, and 48 GPIO. We need to
adapt the range to allow the gpio on port 1 to be used
by this driver

Signed-off-by: Giuliano Franchetto <giuliano.franchetto@intellinium.com>
2018-02-17 09:06:20 -05:00
Michael Hope 8ee282e319 led_strip: add a APA102 driver.
The APA102 is a RGB LED with integrated controller.  LEDs can be
daisy-chained and use SPI for communication.  The SPI port is
configured via Device Tree.

Tested on the Adafruit Trinket M0.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-17 08:53:23 -05:00
Leandro Pereira d9538ec6b3 drivers: system_apic: Correctly assert interrupt line number
The interrupt line number is an unsigned integer; it makes no sense to
compare if it is greater than or equal to 0.

Coverity-CID: 182602
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-02-16 22:59:40 -05:00
Andy Ross 564f59060c kernel: SMP timer integration
In SMP, the system timer is used for timeslicing on auxiliary CPUs,
but the base system timekeeping via _nano_sys_clock_tick_announce() is
still done on CPU0 only (because the framework isn't prepared for
asynchronous notification yet).  Skip processing on CPU1+.

Also, due to a hardware interaction* that is difficult to work around,
timer initialization on the auxiliary CPUs is done at the very end of
the CPU bringup, just before the swap into the scheduler.  A
smp_timer_init() API has been added for this purpose.

* On ESP-32, enabling the timer seems to result in a near-synchronous
  interrupt being delivered despite my best attempts to keep it
  masked, then blowing things up because the CPU record isn't set up
  to handle it yet.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross bba98a9c38 drivers/timer/xtensa_sys_timer: Add init/update hooks for asm2
The earlier xtensa layer put the timer initialization and update
directly into the interrupt handler, which is... weird.  Under asm2,
it's just a regular ISR and needs to do the work in the driver.

Really, this driver needs a bunch of cleanup.  The xtensa CPU timer is
two registers and one ISR: a global cycle count register, and a
compare register that will fire the IRQ when they match.  There is
*way* too much code here.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross 39f78b9b85 drivers/timer/xtensa_sys_timer: Correctly declare ISR
The existing hand-written interrupt code is manually calling the timer
ISR, which is sort of silly and about to be replaced.  Correctly
declare the ISR with IRQ_CONNECT() so that a conventional interrupt
handling implementation can find it.  With current code this is a
noop.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Vinayak Kariappa Chettimada 3637d50c25 drivers: flash: nRF5x: Fix co-operation with Bluetooth controller
Fixed incorrect comparison of FLASH_SLOT in microseconds
with ticks elapsed.

This caused Bluetooth controller to try scheduling events
beyond the acceptable soft real-time design limits, due to
the CPU halted for flash erase operation.

Fixes #6229.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-16 12:03:05 +01:00
Anas Nashif 8949233390 kconfig: fix more help spacing issues
Fix Kconfig help sections and add spacing to be consistent across all
Kconfig file. In a previous run we missed a few.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-15 23:20:55 -05:00
Yannis Damigos c4dfa9baec drivers/pinmux/stm32: Fix 80 characters line warnings
Fix warnings about lines longer than 80 characters.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-14 08:51:41 -06:00
Vinayak Kariappa Chettimada 4c123a5162 Bluetooth: controller: Refactor ticker integration into hal
Refactor ticker execution context dependency out into HAL
folder. This decouples ticker from mayfly, enabling porting
towards a more tasklet (if and when kernel gets the support)
style execution contexts type implementation support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-13 13:26:37 +01:00
Andrew Boie ce6c8f347b dma: add system calls for dma_start/dma_stop
As per current policy of requiring supervisor mode to register
callbacks, dma_config() is omitted.

A note added about checking the channel ID for start/stop, current
implementations already do this but best make it explicitly
documented.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-02-12 19:24:25 -05:00
Ramakrishna Pallala 5f1b366713 drivers: i2c: i2c_nios2: Fix format specifiers in log messages
Fix format specifiers in SYS_LOG_ERR messages.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-09 10:11:52 -05:00
Ramakrishna Pallala c9a4fd94ba drivers: i2c: i2c_nios2: Fix SYS_LOG warnings
Fix sys log compilation warnings by defining the
SYS_LOG_LEVEL to SYS_LOG_I2C_LEVEL in Nios-II i2c driver.

This commit fixes Issue #6062

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-08 23:28:28 -05:00
Alberto Escolar Piedras 6c483ead26 native: timer bugfix in tickless mode part
Bugfix in the tickless mode part:
During _time_idle_exit it was not announcing to the kernel the
already passed silent ticks, but it was left for the tick interrupt
itself.
This did not cause any trouble so far as there was only the timer
interrupt in this board.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-08 15:56:48 -08:00
Michael Hope 247782a7b3 sam0: move the UART and SPI configuration into pinmux.
Also pull out the SERCOM pads configuration to defines.  Note that the
SAM0 has a two level configuration - a signal (like TX) is mapped to a
pad, and then a pad is mapped to a function on a pin.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-08 12:09:46 -06:00
Vinayak Kariappa Chettimada 81332c1fc8 clock_control: nrf5: Return -EBUSY on turning off if still in use
Fix return value to -EBUSY instead of 0 when releasing a
reference but not physically turning off the clock.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-08 14:51:31 +01:00
Johan Hedberg 8f5378b9de pwm: nrf5_sw: Fix configuration for nRF51
nRF51 boards require different values for the timer and ppi_base.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-08 11:21:51 +02:00
Savinay Dharmappa 98d6a9928c driver: usb_dw: Move base address and irq num of usb to soc.h
base adrress and irq number moved to soc.h

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-02-07 22:55:11 -05:00
Ramakrishna Pallala 3eb62bc905 drivers: i2c: Add i2c master driver for Nios-II i2c core
Add I2C Master driver for Nios-II I2C soft IP core.

This driver relies upon the Altera HAL I2C driver for all the bus level
transactions, interrupt handling and register programming.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-07 19:37:35 -05:00
Alberto Escolar Piedras 66c1652fb8 native: native_posix timer + irq fix
Added possibility to reconfigure CONFIG_SYS_CLOCK_TICKS_PER_SEC
for the native_posix board (before it could only be 100)
+
Fixed tickless idle support
+
Minor fixes in irq wrapping

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-07 16:28:16 -05:00
Vitor Massaru Iha e9d1015da9 drivers: i2c: esp32: Fix to_read value on i2c_esp32_read_msg()
to_read is the minimum value between I2C_ESP32_BUFFER_SIZE
and (msg.len - 1) rather than the maximum value.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-07 14:52:52 -05:00
Vitor Massaru Iha 74321ec9fd drivers: i2c: esp32: Fix msg.len on i2c_esp32_write_addr()
msg.len is incremented only when I2C master writes to slave.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-07 14:52:52 -05:00
Vitor Massaru Iha 463bfb3489 drivers: i2c: esp32: Fix increase I2C_ESP32_SPIN_THRESHOLD
Increase I2C_ESP32_SPIN_THRESHOLD to avoid read or write timeout.
This is an empirical value.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-07 14:52:52 -05:00
Vitor Massaru Iha 93c3def27e drivers: i2c: esp32: Fix command opcode on i2c_esp32_write_addr()
When I2C Master writes to slave on CMD_Controller, opcode WRITE
was set twice instead of 1 WRITE at the beginning of the
transmission.

And when Master reads from slave, on CMD_Controller,
byte_num = 1 + data_lenght instead of byte_num = 1 at the
beginning of the transmission.

Note that is for 7 bits addresses, to 10 bit adressess is added
more 1 in byte_num as can be seen in the code above this fix.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-07 14:52:52 -05:00
Vitor Massaru Iha 6452b2e5e2 drivers: i2c: esp32: Fix command address on i2c_esp32_write_msg()
The wait address command must be the last command address.

Unncessary variable was removed.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-07 14:52:52 -05:00
Vitor Massaru Iha 685f09779d drivers: i2c: esp32: Fix END opcode on i2c_esp32_write_msg()
After a STOP opcode the transmission stops. The END opcode in this
case is unnecessary.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-07 14:52:52 -05:00
Vitor Massaru Iha 2ef5b6d128 drivers: i2c: esp32: Fix first command on I2C Master
On i2c_esp32_read_msg() and i2c_esp32_write_msg() first command
it should be always RSTART.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-07 14:52:52 -05:00
Vitor Massaru Iha 623c915ab8 drivers: pinmux: esp32: Fix using gpio as IO at the same time.
Since PINMUX_INPUT_ENABLED == 1 and PINMUX_OUTPUT_ENABLED == 0,
we can not set a gpio port as input and output at the same time,

So we always set the gpio as input. Thus, the gpio can be used on
I2C drivers for example.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-07 14:52:25 -05:00
David B. Kinder c2bf3af1de doc: fix misspellings in Kconfig files
Missed some misspellings during regular reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-02-07 14:51:46 -05:00
Erwan Gouriou 2ede6c67ff sensors: move lps25hb and lsm6ds0 to dts
Introduce yaml binding files for sensors LPS25HB and LSM6DS0.
Fix description issue in lps22hb yaml file

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-02-07 10:30:36 -06:00
Ding Tao cdcff62f92 sensor: adxl362: Fix typo on Kconfig file
Replace prefix "BMI160_" with "ADXL362".

Signed-off-by: Ding Tao <miyatsu@qq.com>
2018-02-07 08:35:29 -05:00
Ding Tao 68ca36f8f5 sensor: vl53l0x: Fix Kconfig warning of non-int value
The I2C address of vl53l0x are write in hex, but the VL53L0X_I2C_ADDR
type is int.

Fix this by replace "int" with "hex".

Signed-off-by: Ding Tao <miyatsu@qq.com>
2018-02-07 08:35:29 -05:00
Ding Tao 6c00545d66 native: console: Fix Kconfig "multiple prompts" warnings
NATIVE_POSIX_STDIN_CONSOLE and NATIVE_POSIX_STDOUT_CONSOLE have more
than one prompts, this will cause warnings when run kconfig checks.

Remove one of two prompts.

Signed-off-by: Ding Tao <miyatsu@qq.com>
2018-02-07 08:35:29 -05:00
Rajavardhan Gundi 1e6adba9ef drivers/interrupt_controller: Introduce multi-level interrupt support
In a scenario where a platform harbours multiple interrupts to the
extent the core cannot support it, an interrupt controller is added
as an additional level of interrupt. It typically combines several
sources of interrupt into one line that is then routed to the parent
controller.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-02-06 22:39:05 -05:00
Mark Vels 6324d11535 sensors: tmp112: Fix breakage on stm32f4 platform
It makes no sense to set the restart condition flag on a first message
and some i2c bus drivers (like the stm32 v1 driver) actually reject
them by returning an error from i2c_transfer().

This patch fixes that by using i2c_burst_read() in tmp112_reg_read()
instead. For consistency, tmp112_reg_write() is also changed to use
i2c_burst_write().

Signed-off-by: Mark Vels <mark.vels@team-embedded.nl>
2018-02-06 17:08:35 -05:00
Mark Vels 018b489aea sensors: tmp112: trivial: Add comment about using this driver for TMP102
I have been using this the TMP112 driver with success with a TMP102
connected to to nucleo-f411re board (via I2C1 using PB8/9).

According to the datasheets, both devices are both driver and pin
compatible although the TMP102 is less accurate.
This temperature sensor is not a thermopile sensor type as stated in
comments.

This patch updates that help info

Signed-off-by: Mark Vels <mark.vels@team-embedded.nl>
2018-02-06 17:08:35 -05:00
Marti Bolivar 4e6e7374c4 flash: mcux: implement software write protection (HACK)
Write protection is currently not supported by the mcux flash
driver. This prevents it from working with the DFU subsystem, which
checks the error codes from the write protect routine. Hack it for now
with a semaphore.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-02-06 15:39:45 -06:00
Manivannan Sadhasivam 9e88120fdf drivers: sensor: Add support for CCS811 Digital Gas Sensor
Add support for AMS CCS811 Digital Gas Sensor for monitoring
indoor air quality. This sensor reports the following parameters:

1. Co2 concentration
2. VOC concentration
3. Sensor voltage
4. Sensor current

This driver only supports polling mode as of now.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-02-06 11:16:26 -05:00
Aapo Vienamo f09bab9662 drivers: i2c: nrf5: Make pins for Port 1 configurable
CONFIG_I2C_NRF5_GPIO_SDA_PIN and CONFIG_I2C_NRF5_GPIO_SCL_PIN are
replaced with port specific versions. Board defconfigs relying on the
original names are updated. The driver is also modified to pass the
configure values to registers.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-02-05 16:12:48 -05:00
Aapo Vienamo 22e5b07e52 drivers: i2c: nrf5: Fix SDA pin naming
The instances of where SDA has been typoed SCA are fixed.

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
2018-02-05 16:12:48 -05:00
Punit Vara 6abdcdb789 drivers: vl53l0x: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 2fecb06104 drivers: tmp007: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 212bc9d25f drivers: th02: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 6aca882d08 drivers: sx9500: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 24d3ac5ba2 drivers: sht3xd: 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>
2018-02-05 12:04:20 -06:00
Punit Vara c26a00bf42 drivers: pms7003: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 5fafab34c6 drivers: mpu6050: 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>
2018-02-05 12:04:20 -06:00
Punit Vara ed1576af15 drivers: mcp9808: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 97a3c74191 drivers: lsm9ds0_mfd: 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>
2018-02-05 12:04:20 -06:00
Punit Vara c93ba2f017 drivers: lsm9ds0_gyro: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 1879a4a91f drivers: lsm6ds0: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 223a24d29e drivers: lps25hb: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 78339a6fab drivers: lis3dh: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 28916492dd drivers: lis2dh: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 5c15b68ba8 drivers: isl29035: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 49feececcc drivers: hts221: 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>
2018-02-05 12:04:20 -06:00
Punit Vara d377d63f57 drivers: hp206c: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 51d2a1bd4e drivers: hmc5883l: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 5b5390f84b drivers: hdc1008: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 7c8dada6bc drivers: dht: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 1f992e891c drivers: bma280: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 3754a4f77f drivers: ak8975: 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>
2018-02-05 12:04:20 -06:00
Punit Vara 3a163fb4cb drivers: bmg160: 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>
2018-02-05 12:04:20 -06:00
Paul Sokolovsky 91228142fe sensors: Redefine SENSOR_CHAN_DISTANCE to be in meters
Most of sensor channels defined by Zephyr use the main, unscaled
SI unit. We also have SENSOR_CHAN_ALTITUDE which is defined in
meters. So, it only makes sense to define distance in meters too

The only driver supporting SENSOR_CHAN_DISTANCE as of now is
vl53l0x.c, which was updated accordingly. Also, update doc links
in the driver based on the review comment.

Fixes: #5693

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 10:30:34 -06:00
Michael Hope ebfed3dca7 spi: sam0: fix txrx, NULL buffers, and add a stub async method.
This patches fixes a few bugs with the SAM0 driver:

- txrx was trasnmitting too many bytes
- adds support for NULL buffers to the fast paths
- fixes a NULL dereference on the rx buffer slow path

The tests under tests/driver/spi/spi_loopback now pass.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-05 07:42:58 -08:00
Yannis Damigos 5d3016aa65 boards: arm: stm32f3_disco: Enable SPI_1, SPI_2 ports
Enable SPI1 and SPI2 ports on stm32f3_disco.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-05 09:21:33 -06:00
Michael Hope 0a5725e858 pinmux: sam0: add a pinmux driver for the SAM0 series.
Pin multiplexing is a function of the PORT peripheral.  This change
defines a separate pinmux device at the same address as the PORTs
themselves.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-05 06:31:35 -08:00
Ramakrishna Pallala c02a2bed61 drivers: flash: Add Nios-II QSPI flash driver
Add Altera Nios-II QSPI Flash controller driver which has
has 1024 blocks or sectors wich each sector size being 64K bytes.
This driver supports flash erase, write, read and lock operations.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-05 06:30:50 -08:00
Paul Sokolovsky b7623a85b0 sensors: Redefine SENSOR_CHAN_HUMIDITY in percents, not milli-percents.
Based on the discussion in #5693, the reason why humidity was defined
in milli-percent was likely following Linux which defines it as such
in its sensor subsystem:
http://elixir.free-electrons.com/linux/latest/source/Documentation/ABI/testing/sysfs-bus-iio#L263

However, Linux defines temperature in milli-degrees either, but
Zephyr uses degrees (similarly for most other quantities). Typical
sensor resolution/precision for humidity is also on the order of 1%.

One of the existing drivers, th02.c, already returned values in
percents, and few apps showed it without conversion and/or units,
leading to confusing output to user like "54500".

So, switching units to percents, and update all the drivers and
sample apps.

For few drivers, there was also optimized conversion arithmetics
to avoid u64_t operations. (There're probably more places to
optimize it, and temperature conversion could use such optimization
too, but that's left for another patch.)

Fixes: #5693

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 14:10:39 +01:00
Alberto Escolar Piedras e3f727cc6e native: added stdin handling for shell
Now the native console driver also handles stdin
so we can drive the shell from the command line,
a pipe or a file

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-02 07:48:46 -08:00
Ravi kumar Veeramally 731c7518d2 drivers: cc2520: Change debug information
Driver is 'Busy' can be a warning message which can be enabled with
minimum debug level CONFIG_SYS_LOG_IEEE802154_DRIVER_LEVEL=2.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-02-02 16:50:07 +02:00
Jan Van Winkel ff110b4db5 timer: Corrected types in nRF system timer functions
Corrected parameter and return types  in nRF system timer functions

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-02-02 15:28:32 +01:00
Pushpal Sidhu 8e459172e8 drivers: serial: uart_stm32: fix call to LL_USART_SetBaudRate
Some mcu's have USART_PRESC_PRESCALER defined in the function call. Add
a prescaler of div1 to it.

Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
2018-02-02 08:22:27 -06:00
Yannis Damigos a3474a2e2e drivers: spi_ll_stm32: Protect against null TX/RX buffer
TX/RX buffer may be NULL, so check them before use.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-01 08:19:49 -06:00
Yannis Damigos af0c9fc349 drivers: spi_ll_stm32: Enable SPI driver for F1 family
Enables SPI driver for STM32F1 SoCs

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-01 08:19:49 -06:00
Anas Nashif 752d23d119 drivers: pci: when enumerating, only print the device info
When enumaring, we do not want to print the header for every device.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-01 02:19:45 -05:00
Ricardo Salveti 3f1dbfda15 pwm: nrf5_sw: don't disable timer if another channel is still active
Check if all channels are inactive before stopping the timer.

Signed-off-by: Ricardo Salveti <ricardo@opensourcefoundries.com>
2018-01-31 19:51:12 -05:00
Ricardo Salveti ab399a1cf0 pwm: nrf5_sw: do not use 'inversed' polarity by default
The default PWM polarity was 'inversed', which is not aligned with the
other PWM drivers. Unfortunately there is not yet an API to define the
default polarity to be used by the driver, but assume that 'normal'
(signal starts high for the duration of the duty cycle) should be the
default.

Signed-off-by: Ricardo Salveti <ricardo@opensourcefoundries.com>
2018-01-31 19:51:12 -05:00
Ricardo Salveti cec073c35c pwm: nrf5_sw: add support for SYS_LOG
Useful for debugging the period and pulse values used by the driver.

Signed-off-by: Ricardo Salveti <ricardo@opensourcefoundries.com>
2018-01-31 19:51:12 -05:00
Maureen Helm 262595f09f drivers: flash: Implement flash page layout api in mcux driver
Uses the new flash erase-block-size dts property to implement the flash
page layout api in the mcux flash driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 16:43:40 -06:00
Andy Gross 94afaa3845 sensor: hts221: Fix assert logical error
This patch fixes a logical error in a assert statement uncovered by
Coverity.

Coverity-CID: 182588

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-01-31 11:03:26 -06:00
Maureen Helm 641aa5c58a dts: sensor: Add dts yaml bindings for the max30101 sensor
Adds dts yaml bindings for the max30101 sensor to allow the sensor
driver name, i2c driver name, and i2c address to be extracted from dts
instead of kconfig.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 10:17:58 -06:00
Maureen Helm fd8a9ae89c dts: sensor: Add dts yaml bindings for the fxas21002 sensor
Adds dts yaml bindings for the fxas21002 sensor to allow the sensor
driver name, i2c driver name, and i2c address to be extracted from dts
instead of kconfig.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 10:17:58 -06:00
Maureen Helm 88d5949b94 dts: sensor: Add dts yaml bindings for the fxos8700 sensor
Adds dts yaml bindings for the fxos8700 sensor to allow the sensor
driver name, i2c driver name, and i2c address to be extracted from dts
instead of kconfig.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 10:17:58 -06:00
David B. Kinder baed5a59c7 doc: fix misspellings in Kconfig files
Fix misspellings in Kconfig files used for configuration docs.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-01-30 20:03:40 -05:00
Tomasz Bursztyka c968a85d85 drivers/spi: Properly check for rx/tx and buffering on
Current buffers might be configured to skip data, thus only len will be
set, buf will be NULL. Buffer should be used if only len is > 0 and
buffer is valid as well.

tx/rx are "on" if len is > 0
tx/rx buf should be touched if only len is > 0 _and_ buf != NULL.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-01-29 23:30:55 -05:00
Kamil Sroka 32907813b9 drivers: 15.4: nrf5: Add OpenThread support to 802.15.4 driver
Initially add support for OpenThread only for nRF 802.15.4 radio driver.

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2018-01-29 22:42:03 -05:00
Kumar Gala b51cfeae60 sensors: dts: cleanup usage of HAS_DTS_I2C_DEVICE
Move to new Kconfig pattern in which we use an if !HAS_DTS_I2C_DEVICE
block for the Kconfig symbols that can now come from DT generation.
This pattern is useful to allow us to define default values for the
generated symbols for build-all testing.

Fixes: #5877

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 22:25:41 -05:00
Kumar Gala a394693d2f drivers: flash: NXP k6x/kw2xd: Convert to use device tree
Convert NXP k6x and kw2xd flash driver to use device tree to get the
flash controller name from device tree.  We introduce yaml bindings for
the "nxp,kinetis-ftfe" and "nxp,kinetis-ftfl" devices.

Fixes: #5788

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 16:34:49 -06:00
Loic Poulain b23d599682 usb: stm32: Introduce transfer method
Transfer is an important concept of USB specification.
During a transfer, several packets can be transmitted.
Today the usb API only provides ep_read and ep_write
functions but the transfer concept is missing.

This is typically ok for basic drivers which don't have
to take care of how data is transfered/splitted.
However there are some drivers like CDC EEM, in which
transfer concept is important for packet management.

Moreover, current ep-write and ep_read method have a
different implementation in usb_dc_dw and usb_dc_stm32
device drivers. For example usb_dc_dw supports only
1-data-packet transfers due to its implementation.
This can increase latency and reduce performance.

I think this is something we need to fix/improve by
implementing better transfer management.

This patch introduces usb_dc_ ep_transfer method which
can be used to configure IN/OUT transfers. This allows
to configure and request different transfer sizes and
should prevent usage of the current stm32 temporary
buffer.

This method has asynchronous and synchronous mode.
Synchronous mode waits for transfer completion before
returning. Asynchronouse mode (irq safe) configures
the transfer and returns immediately, the provided
callback will be then called on transfer completion.

This also update ep_write and ep_read stm32 implementation
to use this new method but keep their behavior unchanged
for legacy reasons.

Note that for now this method is local to stm32 device
driver, however the goal would be to expose this function
as a new USB device driver API method so that class
drivers use it. This will request same implementation in
the usb_dc_dw_driver.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-01-29 11:26:48 -06:00
qianfan Zhao cd931bb7c4 usb: stm32: add usb_dc_ep_read_wait/conitinue
usb mass example need usb_dc_ep_read_wait/continue API.
test usb mass storage with RAM DISK on stm32f4 series.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-01-29 11:26:48 -06:00
Anas Nashif 5656489ac8 drivers: ioapic: remove pre DTS kconfigs
All X86 boards now using DTS.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-29 10:38:32 -06:00
Kumar Gala 54c0caeb2b sensor: hts221: Cleanup Kconfig for driver & bus name
Move to use an if HAS_DTS_I2C_DEVICE instead of depends on so that the
Kconfig sybmols don't even show up if HAS_DTS_I2C_DEVICE is true.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 09:47:14 -06:00
Kumar Gala 2dfee62a5e drivers: flash: atmel sam0: Convert to use device tree
Convert Atmel SAM0 flash driver to use device tree to get the flash
controller name and base address.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-27 21:09:28 -06:00
Daniel Wagenknecht aacd802fbe pinmux: stm32f0: add additional defines for I2C2
Adds pinmux defines to use I2C2 at PB10/PB11 for
stm32f0-based boards.
Needed for stm32f072b_disco board to use extension
connector

Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2018-01-26 09:57:44 -06:00
Kumar Gala dc98605f4a drivers: flash: stm32: Convert to use device tree
Convert STM32 flash drivers to use device tree to get the flash
controller name and base address.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-26 09:25:57 -06:00
Kumar Gala 26e4da52cf arm: nordic: flash: Use FLASH_DEV_NAME define
We want to move to use a common FLASH_DEV_NAME across the various flash
drivers. So samples, tests, or other code can be a bit more generic.  So
replace CONFIG_SOC_FLASH_NRF5_DEV_NAME with FLASH_DEV_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-25 15:23:00 -06:00
Neil Armstrong 7474ad6286 boards: arm: Add stm32f072-eval board support
Add the STM32F072-EVAL Board minimal support.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2018-01-25 15:13:53 -06:00
Neil Armstrong c406b95c40 drivers: clock_control: simplify CLOCK_STM32_PLL_PREDIV1 config
Remove SoCs part dependency of CLOCK_STM32_PLL_PREDIV1 config since
it will only be used on parts having an HSE oscillator, ignored
otherwise.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2018-01-25 15:13:53 -06:00
Kumar Gala f06a1d84ed spi: sort drivers into legacy or not in CMakeLists.txt
Sort the drivers to make it explicit of which drivers are supporting
the legacy API vs the new API.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-24 18:27:27 +05:30
Kumar Gala 80c4985342 spi: cleanup whitespace in CMakeLists.txt
Use tabs everywhere instead of spaces and tabs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-24 18:27:27 +05:30
Kumar Gala f19ab5efba irq: move shared irq support under drivers/interrupt_controller
The shared irq support doesn't really require its own dir, lets merge it
into drivers/interrupt_controller.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-23 13:37:01 -06:00
Andrzej Puzdrowski ff7dfc4fb4 dts: bindings: add support for the flash driver name
So far, DT did not support the flash driver name.
Any flash-controller should have the appropriate
flash driver that should be identified by its name.

This path adds generic support for extract the description
from the flash-controller node,
adds implementation of this property for all nrf5x targets.


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-23 12:29:50 -06:00
Vincent Veron 096314872a drivers: sensor: vl53l0x: ST library customization for Zephyr
The generic library provided by ST in ext/hal/st/lib/sensor/vl53l0x
needs to be adapted to the platform. In this case, the main
modification is the way to use I2C. This is now using the Zephyr
I2C API.

Signed-off-by: Vincent Veron <vincent.veron@st.com>
2018-01-23 10:14:49 -06:00
Vincent Veron 347560459b driver: sensor: Add vl53l0x
Add driver for ST vl53l0x time of flight sensor.
This driver can be used in 2 modes :
  * proximity sensor :
      configure VL53L0X_PROXIMITY_THRESHOLD
      will return 1 if target is between sensor and threshold,
      else, 0
  * distance sensor :
      will return the distance in millimeters from sensor to target

This driver use the official STMicroelectronics library for vl53l0x.
(in ext/hal/st/lib/sensor/vl53l0x)

Signed-off-by: Vincent Veron <vincent.veron@st.com>
2018-01-23 10:14:49 -06:00
Shiksha Patel 1dc7e90c03 lpc: Add gpio mcux driver for lpc
Add gpio mcux driver which can be used for lpcxpresso54114 and other lpc
socs. In this driver, CMSIS register access is made for GPIO.

Option for access by GPIO Pin is provided as of now.

Signed-off-by: Shiksha Patel <shiksha.patel@nxp.com>
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-23 09:18:32 -06:00
Shiksha Patel 53cbfd3fd3 lpc: Add usart shim driver for lpcxpresso54114
Add usart-yaml in dts.

Build fsl_lpc_usart and fsl_lpc_flexcomm in
ext/hal/nxp/mcux/drivers/Makefile.

Only polling mode is implemented in usart now. Interrupt can be added in
future.

Signed-off-by: Shiksha Patel <shiksha.patel@nxp.com>
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-23 09:18:32 -06:00
Shiksha Patel 40d9763611 lpc: Add pinmux shim driver for lpcxpresso54114
Adds a new pinmux driver for lpcxpresso54114 based on mcux.

Signed-off-by: Shiksha Patel <shiksha.patel@nxp.com>
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-23 09:18:32 -06:00
Erwin Rol 23bb4e6101 drivers: spi: stm32: use Kconfig to select HAL/LL sources
Use "select USE_STM32_LL_SPI" to select the needed STM32 LL files,
instead of editing ext/hal/st/stm32cube/CMakeLists.txt

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-01-23 08:46:16 -06:00
Erwin Rol 780c1efb9f drivers: usb: stm32: use Kconfig to select HAL/LL sources
Use "select USE_STM32_LL_USB/USE_STM32_HAL_PCD/USE_STM32_HAL_PCD_EX"
to select the needed STM32 HAL files, instead of editing
ext/hal/st/stm32cube/CMakeLists.txt

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-01-23 08:46:16 -06:00
Erwin Rol 1537b4502b drivers: entropy: stm32: use Kconfig to select HAL/LL sources
Use "select USE_STM32_LL_RNG" to select the needed STM32 LL files,
instead of editing ext/hal/st/stm32cube/CMakeLists.txt

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-01-23 08:46:16 -06:00
Erwin Rol d54aaa0326 drivers: pwm: stm32: use Kconfig to select HAL/LL sources
Use "select USE_STM32_HAL_TIM" to select the needed STM32 HAL files,
instead of editing ext/hal/st/stm32cube/CMakeLists.txt

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-01-23 08:46:16 -06:00
Erwin Rol 5ed492e0c7 drivers: i2c: stm32: use Kconfig to select HAL/LL sources
Use "select USE_STM32_LL_I2C" to select the needed STM32 LL files,
instead of editing ext/hal/st/stm32cube/CMakeLists.txt

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-01-23 08:46:16 -06:00
Erwin Rol 33525c3e5d drivers: ethernet: eth_stm32_hal: use Kconfig to select HAL/LL sources
Use "select USE_STM32_HAL_ETH" to select the needed STM32 HAL files,
instead of editing ext/hal/st/stm32cube/CMakeLists.txt

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-01-23 08:46:16 -06:00
Erwin Rol 6342938bba drivers: clock control: stm32: use Kconfig to select HAL/LL sources
Use "select USE_STM32_LL_UTILS" to select the needed STM32 LL files,
instead of editing ext/hal/st/stm32cube/CMakeLists.txt

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-01-23 08:46:16 -06:00
Jason Wang 6de7240d55 cmake: Fix console could not work on board frdm_kl25z
The CMakeLists lost the config for uart_mcux_lpsci.c, which is the
console driver for board frdm_kl25z. So just add "uart_mcux_lpsci.c"
into drivers/serial/CMakeLists.txt to make it work.

Signed-off-by: Jason Wang <jason.yanping.wang@hotmail.com>
2018-01-23 09:03:08 +05:30
Yannis Damigos 8faa307d74 dts: add spi device support for SPI bluetooth modules
Provides HAS_DTS_SPI_DEVICE flag to enable dts based
generation for SPI bluetooth modules

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-01-22 18:08:51 -06:00
Erwan Gouriou 5ef0019a24 drivers: flash: stm32: get write block size from device tree
In flash driver init, write_block_size could be initialized
with FLASH_WRITE_BLOCK_SIZE which is generated from device
tree parsing (dts property: "write-block-size")
Fixes #5305
If not defined, generate a compilation error.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-19 12:16:00 -06:00
Yannis Damigos 3a03b28f87 drivers: spi_ll_stm32: Get SPI configuration from DT
Get SPI_*_BASE_ADDRESS, SPI_*_NAME, SPI_*_IRQ and
SPI_*_IRQ_PRI from DT.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-01-17 11:51:48 -06:00
Vitor Massaru Iha 53ccc84f88 drivers: i2c: esp32: Fix status address register
I2C_BUS_BUSY flag is in I2C_SR_REG according i2c_reg.h.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-01-16 13:48:27 -05:00
Tomasz Bursztyka 8ded57d3a2 drivers/ieee802154: Add support for Sub-GHz TI CC1200 chip
CC1200 is a sub-ghz chip supporting 6 ISM & SRD bands: 169, 433, 470,
868, 915 and 920 MHz, with features dedicated to IEEE 802.15.4(g).

Current driver enables CC1200 against actual IEEE 802.15.4 Soft-MAC. 'g'
version support in the Soft-MAC will follow later.

The chip itself is closer to a bare metal radio modem than to a usual
15.4 chip: up to the user to provide the right RF settings for the
carrier band. Such settings can be generaten through TI's SmartRF tool.

Hopefully, for channel selection, this driver will be clever enough to
compute the proper register change without any special input from the
user. This will work for all the bands supported by the chip.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-01-15 15:15:38 +02:00
Manivannan Sadhasivam 2b0821cce7 drivers: i2c: stm32f4: Fix incorrect buffer assignment
Wrong buffer assigned for receiving the last 2 bytes in multi
byte reception of STM32F4 i2c driver. Change the buffer to
correct one.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-01-13 11:36:15 -08:00
Erwan Gouriou 2867b8641a Revert "sensors: hts221: provide name to Kconfig choice"
This reverts commit 2a7efb7419.

"choice" section in board Kconfig.defconfig introduces a dependency
from the sensor to the board. As a consequence a warning was generated
whenever the sensor was used on another board.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-13 09:06:58 -08:00
Erwan Gouriou 11eac235bc Revert "sensors: lis3mdl: provide name to Kconfig choice"
This reverts commit 2e20f49167.

"choice" section in board Kconfig.default introduces a dependency
from the sensor to the board. Then a warning was generated
whenever the sensor is used on another board

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-13 09:06:58 -08:00
Michael Hope 73d045e281 spi: add a SPI driver for the SAM0 series.
Impleentation is master only and uses polling to read and write.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-13 07:39:05 -05:00
Michael Hope af0718dc3a spi: add Kconfig entries for SPI4 and SPI5.
The SAM0 series has up to 6 SPI ports.  Add Kconfig options to match.

Similar to the 9033fb2f01, this patch
only defines the fields that are currently used and skips ones like
GPIO and IRQ priority that aren't.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-13 07:39:05 -05:00
Kumar Gala b92a40a798 drivers: entropy: stm32: Remove STM32F411XE from building
It appears the STM32F411XE doesn't support RNG so remove enabling it
from the SoC defconfig and flag an error if attempting to build the
driver on that SoC.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-12 19:42:54 -05:00
Manivannan Sadhasivam 1bd48edd26 drivers: i2c: stm32f4: Add check for BTF flag before reading N-2 byte
According to STM32F4 reference manual, software should wait for BTF=1
before reading N-2 data byte.

Reference:

"For N >2 -byte reception, from N-2 data reception" section, page
853 of STM32F4 Reference manual.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-01-12 09:33:27 -06:00
Andrei Emeltchenko af0bf06aa3 usb: Fix USB Device dependency
USB Device stack should depend on supported drivers not on menuconfig
option.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-01-12 07:46:28 -05:00
Michael Hope cd92dd139b flash: add a driver for the internal flash on the SAM0 series.
The SAM0 has a 64 byte page (the programing unit) with 4 pages to a
row (the erase unit).  This driver implements a read/modify/write to
emulate the byte level writes used by NFFS.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-11 19:03:52 -05:00
Erwan Gouriou 164fb32cf6 drivers: entropy: stm32: limit driver to SoC supporting it
In STM32 family, RNG IP is available only on F4 and L4 series.
Besides STM32F401 does not support is neither.
Get entropy driver available on STM32 devices supporting it and
generate a compilation issue on STM32 devices that do not own
the RNG IP.

Solves #5448

Signed-Off-By: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-11 19:00:19 -05:00
Erwan Gouriou 48ff51af75 drivers: entropy: Clock activation is missing on stm32l4
On STM32L4 SoCs RNG is clocked by 48MHz domain.
Hence, besides clock activation, it requires 48M
domain to be enabled.

Tested on:
*nucleo_l476rg
*stm32l476g_disco
*disco_l475_iot1

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-11 19:00:19 -05:00
Florian Vaussard 59f0c99f0e spi: stm32: Correctly apply CPOL and CPHA settings
SPI_MODE_GET() returns a bitfield. It is thus wrong to test if a bit is
set using the equality operator. The bit-wise AND operator must be used
instead.

This can be tested by setting the SPI in mode 3 (CPOL + CPHA). Currently
both tests will fail and the result is a SPI configured in mode 0. This
was confirmed using an oscilloscope. Applying the patch fixes the
polarity.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-01-11 19:00:19 -05:00
Florian Vaussard 5491c29314 i2c: stm32_ll: Fix spurious error while reading using IRQ
We can have a spurious error while performing a transfer using IRQ. This
happens when the last message of the transfer is a read with a STOP
condition. We must disable the RX interrupt while waiting for the STOP
interrupt, otherwise we will get a spurious RX interrupt which will lead
to an error.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-01-11 19:00:19 -05:00
Daniel Wagenknecht 1f66015f73 drivers: serial: use the right clock busses for STM32F0 series UARTs
STM32F0 Series uses different clock busses for UARTs than other
STM32FX Series.

fixes #5406

Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2018-01-11 19:00:19 -05:00
Daniel Wagenknecht 47c747e954 drivers: serial: simplify STM32 UART clock initialization
STM32 UART driver uses a macro for clock initialization, that
is difficult to read and incompatible with needed changes to
fix STM32F0 series UART problems.
This change switches to using the full clock bus names in UART
init functions removing the macro-magic and increasing
readability.

Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2018-01-11 19:00:19 -05:00
Daniel Wagenknecht 39bb93d402 drivers: stm32 clock control: fix HSI PLLSOURCE with PREDIV1 support
The combination of
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL and
CONFIG_CLOCK_STM32_PLL_SRC_HSI
on SOCs with PREDIV1 support made use of the LL define
LL_RCC_PLLSOURCE_HSI_DIV_2, which is not defined for SOCs with
PREDIV1 support.

This exchanges LL_RCC_PLLSOURCE_HSI_DIV_2 with LL_RCC_PLLSOURCE_HSI
which is the appropiate source according to stm32f0xx_ll_rcc.h
line 473 and stm32f3xx_ll_rcc.h line 795.

Tested by compiling hello world for nucleo_f091rc board with HSI as
PLLSOURCE.

Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2018-01-11 19:00:19 -05:00
Neil Armstrong 9dfb73c12a pinmux: stm32f0: Add B3/4/5 SPI1 B13/14/15 SPI2 pinmux
Add STM32F0 Pinmuxes for SPI1 and SPI2 controllers to be used on
the nucleo_f091rc board.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2018-01-11 19:00:19 -05:00
Neil Armstrong 7caa56f608 spi: spi_ll_stm32: Add support for STM32F0
Add support for STM32F0 similar to STM32F3 and STM32L4

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2018-01-11 19:00:19 -05:00
Yannis Damigos ef0d77b74e drivers: gpio_stm32: Add defines for ports I, J, K
This patch adds defines for ports I, J, K and
refactors gpio_stm32.h file.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-01-11 14:35:45 -06:00
Carles Cufi 7d764b35f3 cmake: Use path-corrected version of ZEPHYR_BASE
Instead of accessing the environment variable ZEPHYR_BASE every time we
require accessing the source code root, use an intermediate variable
that has OS path separators correctly set to '/' to avoid issues on
Windows.

Note: This removes the ZEPHYR_SOURCE_DIR CMake variable. External
applications using that will need to change to use the new ZEPHYR_BASE
variable.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-11 14:59:03 -05:00
Tomasz Bursztyka f4664f1d9a drivers/ieee802154: Cleaning up CMakeLists.txt
Old reference on driver's specific raw mode was still lurking around.
Removing those.

Fixes #5270

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-01-10 21:53:01 -05:00
Tomasz Bursztyka 5195ddf472 drivers/ieee802154: Cleanup Kconfig
A very old reference to former net stack was still lurking around.
Removing it.

Taking the opportunity to clear up dependencies.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-01-10 21:53:01 -05:00
Michael Hope 17fcbc3f9b serial: sam0: add support for interrupt based transmit.
Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-10 21:49:18 -05:00
Jukka Rissanen e63a781612 drivers: eth: mcux: Use correct Kconfig option for RX bufs
The mcux ethernet driver was using TX buf count when allocating
RX buffers.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-01-10 10:32:16 -06:00
Anas Nashif f6aefe5f17 drivers: ti_adc108s102: remove newline from syslog messages
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-09 10:59:41 -05:00
Erwan Gouriou 89eb2d2057 drivers: ethernet: stm32: various small changes
Amend stm32 ethernet driver with small changes:
*Provide HAL_ETH_Init return value in error message,
return on error and move it before thread creation
*Provide computed MAC address in debug message

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-09 08:44:03 -06:00
Gil Pitney e5cef70abd drivers: i2c: Add support for cc32xx I2C bus
This was validated on the cc3220sf_launchxl board
using the Zephyr thermometer sample program
adapted to call the i2c driver directly, and fetching
samples from the on-board TMP006 temperature sensor.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-01-09 08:39:59 -06:00
Anas Nashif 7ae749828f kconfig: fix help text indentation
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 08:08:45 -05:00
Johann Fischer 476f05d2f8 drivers: sensors: add driver for amg88xx sensor
This patch adds the driver for Panasonic AMG88xx
infrared array sensor.

The driver was developed within the framework of a student
internship in the development department. The task of the
student was to implement the trigger part of the driver,
transfer and visualization of the measured data.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-01-07 16:04:45 -05:00
Michael Hope b85b676ba9 serial: add a serial driver for the SAM0 family.
Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-04 13:18:25 -05:00
Michael Hope 54c6fbdca7 gpio: add a GPIO driver for the SAM0 family.
Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-04 13:18:25 -05:00
Michael Hope be8cba4bad watchdog: add a watchdog driver for the SAM0 family.
Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-04 13:18:25 -05:00
Paul Sokolovsky e25df54eae various: Update/fix some textual material and code comments.
Of these, only struct net_ipv6_nbr_data::send_ns is a descriptive
change:

send_ns is used for timing Neighbor Solicitations in general, not
just for DAD.

The rest are typo/grammar fixes.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-12-29 09:45:39 -05:00
Anas Nashif 6b55598ad4 board: posix: add native_posix board definition
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Ramakrishna Pallala 12d614d0b8 drivers: gpio: add support for Altera Nios-II PIO controller
The PIO cores on Altera Nios-II processors can be used
for GPIOs and each PIO core can be configured as Input only,
Output only or as Bidirectional port from the Qsys tool.

The present Nios-II softcpu image on the Zephyr only has the
support for Output only port and the PIOs[0:3] are wired to
LED[0:3] on the Altera MAX10 board.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-12-21 12:02:24 -08:00
Anas Nashif e2122cbf89 lib: move ring_buffer from misc/ to lib/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-15 20:02:01 -05:00
Anas Nashif 6daf046e8f lib: move crc from drivers to lib/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-15 20:02:01 -05:00
Savinay Dharmappa 21c2cf78f2 driver: serial: Get interrupt number from dts
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-12-15 11:22:55 -06:00
Savinay Dharmappa 54239d50a4 dts: x86: Add interrupt controller node
patch adds interrupt controller node and interrupt
property for device nodes.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-12-15 11:22:55 -06:00
Erwan Gouriou 65747e8702 dts: add sensors dts support for some sensors
Provide HAS_DTS_I2C_DEVICE flag to enable dts based generation for
these sensors.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-12-14 11:30:44 -06:00
Anas Nashif 429c2a4d9d kconfig: fix help syntax and add spaces
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-13 17:43:28 -06:00
Maureen Helm 112800d6c1 drivers: slip: Remove stale CMakeLists.txt
The slip driver was moved to drivers/net around the same time as the
conversion to CMake,

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-12-13 18:25:11 -05:00
Wayne Ren 528c960ae7 arch: arc: Add the support of secure mode for em
In ARC's SecureShield, a new secure mode (currently only em) is added.
The secure/normal mode is orthogonal to kernel/user mode. The
differences between secure mode and normal mode are following:

* different irq stack frame. so need to change the definition of
  _irq_stack_frame, assembly code.

* new aux regs, e.g, secure status(SEC_STAT), secure vector base
  (VECT_BASE_S)

* interrupts and exceptions, secure mode has its own vector base;
  interrupt can be configured as secure or normal through the
  interrupt priority aux reg.

* secure timers. Two secure timers (secure timer 0 and timer 1) are
  added.Here, for simplicity and backwards compatibility original
  internal timers (timer 0 and timer1) are used as sys clock of zephyr

* on reset, the processor is in secure mode and secure vector base is
  used.

Note: the mix of secure and normal mode is not supported, i.e. it's
assumed that the processor is always in secure mode.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2017-12-13 12:05:33 -05:00
Andrzej Puzdrowski d095963e73 drivers: flash: Assert implementation of Flash Page Layout
Some drivers doesn't implement flash API page layout extension
which is causing the application crash once the API was calling.
This patch introduce system termination for this in those drivers
which doesn't implement extension. This will help to discover this
problem early.

It is not done by preprocessor check because it is possible to have
enabled a driver which support and a driver which doesn't support
this API simultaneously.

Now FLASH_PAGE_LAYOUT configuration option is accessible only in case
that at last one driver which implements mentioned API is enabled.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-12-12 14:23:50 -06:00
Yannis Damigos c2a0789d5f boards: stm32f3_disco: Use pins PA9/PA10 for I2C_2
On stm32f3_disco pins PF0/PF1 are used for OSC_IN/OSC_OUT
signals. Use pins PA9/PA10 for I2C_2 port

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-12-12 12:36:08 -06:00
Neil Armstrong 41cfa37b8c pinmux: stm32f0: add I2C1 and I2C2 pinmux
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-12-12 12:36:08 -06:00
Neil Armstrong 59d33b5f27 i2c: stm32_ll: add support for STM32F0 with combined irq
The STM32F0 has only a single IRQ line, add a combined IRQ handler.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-12-12 12:36:08 -06:00
Neil Armstrong 32cb3f0220 flash: stm32: add support for STM32F0 flash controller
Add the STM32F0 Embedded Flash support in the flash_stm32 driver
interface.
The STM32F0 has a particularity or use the HSI as clock source
for the flash controller interface, so this clock must be
enabled directly in the case HSE or another clock is used by
the system clock.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-12-12 12:36:08 -06:00
Paul Sokolovsky 2a795a19ff drivers: eth_mcux: Implement IPv6 multicast group joining/leaving
IPv6 mcast addr to MAC mcast conversion was factored out to
subsys/net/ip/l2/ethernet.c for reuse by other drivers.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-12-12 09:24:51 -05:00
Vitor Massaru Iha c969ddbdd8 drivers: gpio: esp32: Check return value of pinmux_pin_input_enable()
Some gpio pins are only input, and this assert is for check if
they were set as output.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2017-12-11 09:21:53 -05:00
Paul Sokolovsky 81ecfc3506 drivers: eth_mcux: Disable promiscuous mode by default
Now that proper solicited-node multicast group joing is implemented,
promiscuous mode's purpose is reduced to just debugging needs.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-12-11 09:09:48 -05:00
Sebastian Bøe 1bb47676a9 kconfig: 802154: nrf: Fix kconfig
This fixes a regression from
https://github.com/zephyrproject-rtos/zephyr/pull/5018

The ieee802154 driver wouldn't build because nrf drivers/ieee802154
depends on the nordic ext drivers to build.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-12-06 11:11:59 -06:00
Erwan Gouriou 222bc6096b drivers: serial: stm32: report only unmasked irq
Fix #5298
irq_is_pending function returned TXE/RXNE flag status
even if IRQ was masked, which led to enless loop
in uart_pipe when no TX was performed. Fix by reporting status only when
IRQ is unmasked.

Signed-Off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-12-06 09:42:51 -06:00
Neil Armstrong 958acd1b4e flash: stm32l4x: fix build
Fix build since current file directly is no more in the include path.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-12-04 10:53:12 -06:00
Ioannis Glaropoulos ffbc28a465 drivers: serial: Fix nRF5x UART IRQ Mask values
In uart_nrf5.c the IRQ masks for the TX READY and ERROR events are
incorrect. This pull request fixes the mask values so they are
according to the nRF51/nRF52832/nRF52840 product specification.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2017-12-04 12:26:14 +01:00
Piotr Mienkowski dafdfadfbe drivers: Add Atmel SAM I2S (SSC) driver
Added Inter-IC Sound driver (based on SSC module) for Atmel
SAM MCU family.

Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-2509
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-30 10:30:33 -05:00
Piotr Mienkowski fce40c4795 drivers: add missing i2s directory to CMakeLists.txt
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-30 10:30:33 -05:00
Piotr Mienkowski dbcc7429e6 drivers: Add Atmel SAM DMA (XDMAC) driver
Added DMA (XDMAC) driver for Atmel SAM MCU family. The driver provides
private DMA API to be used by the SAM family device drivers. Public
DMA API to be used by user space programs is currently missing.

Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-1609
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-30 10:30:33 -05:00
Michael Hope 21b94bacd9 flash: minor documentation improvements.
This patch makes minor improvements to the flash documentation:

* spi -> SPI
* Capitialise the first word in a sentance
* Adding the, and, all, etc where appropriate.

Signed-off-by: Michael Hope <mlhx@google.com>
2017-11-28 12:25:19 -05:00
Daniel Wagenknecht 02a46e7197 drivers: i2c_ll_stm32_v2: don't use while loops in interrupt mode
Waiting for transfer complete and stop condition uses while loops
even when interrupt mode is enabled.
Implement use of TC, TCR and STOP interrupt for interrupt mode.
msg_done is not needed in interrupt mode anymore, so move it
to non-interrupt section
Tested with stm32f3_disco board.

Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2017-11-28 11:21:06 -06:00
Daniel Wagenknecht 5380bc597f drivers: i2c_ll_stm32_v2: reorder to remove duplication
Disabling of Interrupts is duplicated. Move it to a position
that is common to messages that end with and without errors.

Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2017-11-28 11:21:06 -06:00
Yongfa Zhou ce6f6f4985 drivers: sensor: Fix some code style issues
Signed-off-by: Yongfa Zhou <yongfa.zhou@intel.com>
2017-11-27 22:17:38 -05:00
Yongfa Zhou 85c6b060b0 drivers: sensor: Add plantower PMS7003 Driver
Tested on STM32F103 board

Origin: Original

Signed-off-by: Yongfa Zhou <yongfa.zhou@intel.com>
2017-11-27 22:17:38 -05:00
Anas Nashif 938a8aadaa kconfig: fix type of config for nrf5 15.4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-23 07:29:13 -05:00
Leandro Pereira 07e1a64e77 drivers: i2c_gpio: Use quoted #include directive for i2c_bitbang
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-11-22 18:49:17 -05:00
Vinayak Kariappa Chettimada c983f670f6 drivers: pwm: nRF5x: Use TIMER2 and PPI indices 14-19
As the nRF5x BLE controller uses TIMER1, TIMER2 and PPI
indices 0-13 (and 14-15, if PA/LNA feature is enabled),
the software based PWM driver needing 6 PPI channels has
to use PPI indices outside the BLE controller used range.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-11-22 18:46:20 -05:00
Tomasz Bursztyka b52c0f24a6 net/ieee802154: Make RAW mode generic
- Renaming NET_L2_RAW_CHANNEL to NET_RAW_MODE
- Create a generic IEEE 802.15.4 raw mode for drivers
- Modify the IEEE 802.15.4 drivers so it passes the packet unmodified,
up to code using that mode to apply the necessary changes on the
received net_pkt according to their needs
- Modify wpanusb/wpan_serial relevantly

Fixes #5004

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-11-22 10:10:09 -05:00
Vitor Massaru Iha bed7698ac0 pinmux: esp32: Unnecessary iteration in "for" loop
In this case: "pin == ARRAY_SIZE(pin_mux_off)" is invalid and it
isn't necessary to iterate.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2017-11-20 16:39:58 -05:00
Vitor Massaru Iha 6a513ef65d drivers: gpio: Fix typo on esp32
esp32 has 40 gpio ports but some ranges are wrote 32_63 instead of
32_39.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2017-11-18 07:43:29 -05:00
Ramakrishna Pallala 37ee913908 drivers: serial: Add Altera shim driver for JTAG UART soft IP
Delete the native UART JTAG driver as we will be reusing
the Altera's HAL driver.

Add the shim driver support for Altera HAL's JTAG UART soft IP.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-11-17 07:46:40 -05:00
Ramakrishna Pallala eb51886d8c drivers: timer: Add Altera shim driver for timer soft IP
Delete the native timer soft IP driver as we will be reusing
the Altera's HAL drivers for most of the soft IP's.

Add shim driver support for Altera timer system clock soft IP.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-11-17 07:46:40 -05:00
Anas Nashif 84ea59f00e drivers: crypto: add missing CMakeLists.txt file
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-16 05:48:16 -05:00
Piotr Mienkowski 8bfcfe5545 drivers: i2c: Add DTS support for i2c_sam_twihs driver
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-15 11:13:08 -06:00
Piotr Mienkowski 1f47ed75b7 drivers: i2c: rename twihs_sam to i2c_sam_twihs
Rename the Atmel SAM I2C driver based on TWIHS module to match the
convention:
<driver class>_<SoC family>_<hardware module used by the driver>

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-15 11:13:08 -06:00
Piotr Mienkowski e7dd844c6a drivers: i2c: Refactor Atmel SAM (TWIHS) driver
Various minor changes to the Atmel SAM (TWIHS) driver
- clean up variable names, comments
- refactor i2c_clk_set function
- do not save configuration in dev_data
- improve ISR NACK handling
- print "Device initialized" string

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-15 11:13:08 -06:00
Maureen Helm 6043c74fd3 gpio: Introduce mcux igpio shim driver
Adds a new gpio driver for the NXP i.MX family of SoCs. Read, write,
configure, and callback API functions are all implemented.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-11-15 09:09:58 -06:00
Maureen Helm 0f3b490905 clock_control: Introduce mcux ccm driver
Adds a new clock control driver for i.MX SoCs that have the clock
control module (CCM).

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-11-15 09:09:58 -06:00
Maureen Helm 175e4f4953 serial: Add another instance to the mcux lpuart driver
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-11-15 09:09:58 -06:00
Yannis Damigos cf2eb7d1fa drivers: i2c_ll_stm32_v2: Use the correct flags in event ISR
Event ISR checks if the TX/RX interrupts is enabled instead
of the TXIS/RXNE interrupt status flags. Use the TXIS/RXNE
interrupt status flags to check which interrupt event
happened.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2017-11-15 09:09:58 -06:00
Yannis Damigos b80da2b710 drivers: i2c_ll_stm32: Use I2C API flags
STM32 I2C driver doesn't use the I2C API flags STOP/RESTART,
instead it uses its own RESTART flag. As a result, I2C API's
i2c_burst_write* funtions doesn't work. This patch makes
STM32 I2C driver to use I2C API flags.

Tested on: 96b_carbon, olimexino_stm32 (i2c_ll_stm32_v1)
Tested on: stm32f3_disco, disco_l475_iot1 (i2c_ll_stm32_v2)

Fixes: #4459

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2017-11-15 09:09:58 -06:00
Kumar Gala 4b2348c9e7 drivers/ieee802154_kw41z: Fix interrupt priority
The interrupt priority on KW41Z is from 0..3.  The value of 0x80 is
invalid, so lets set it to 0 for now as all the other interrupt
priorities default to 0 right now.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-11-15 08:30:16 -06:00
Kumar Gala 7cd27be39a drivers/ieee802154_kw41z: Update kw41z to support event trace buffer
Added conditionally enabled event state tracing support.
Needed for enhanced debug visibility of tight timed events where
normal print debug messages affect the timing of things. This is a
simple buffer that allows post analysis via gdb of what sequencer
events occurred.

Signed-off-by: David Leach <david.leach@nxp.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-11-15 08:30:16 -06:00
David Leach fcffac92b7 drivers/ieee802154_kw41z: Reduce debug logging due to false positives
- Removed some debug output and changed the level of others to reduce
  the amount of information logged. The reason is that some of this is
  causing false positive distractions.
- Removed enabling of FILTER error IRQ events. It isn't needed and is
  only informational.
- Changed frame control AR bit inspection to use native retrieval
  routine.
- Addressed some coding style issues.

Signed-off-by: David Leach <david.leach@nxp.com>
2017-11-15 08:30:16 -06:00
David Leach 280ccbaffb drivers/ieee802154_kw41z: Modified RX handling of filter failures
Changed the logic to reset the sequencer when a RX filter
failure has been detected. This also disables the RX timer
until the next watermark detection.

Signed-off-by: David Leach <david.leach@nxp.com>
2017-11-15 08:30:16 -06:00
David Leach e8431daac0 drivers/ieee802154_kw41z: Stabilize the KW41Z IEEE802.15.4 driver
- Reworked the driver logic around TX/RX to correctly handle the
  expectations of the underlying 802.15.4 hardware IP.
- Fixed a problem with TX always reporting an error to the stack
  which resulted in constant retries.
- Fixed bug in RX to TX transition which would occasionally cause the
  driver to error the TX.
- Changed RX logic to ensure that invalid RX frames were not passed up
  the stack.
- Simplified hardware timer usage to only use TMR3.
- Added RX watermark and TMR3 support to fix a hardware problem where
  the hw IP can get stuck on a receive in noisy environments.
- Modified samples/net/echo_client and echo_server kw41z project config
  files to provide enanced debug visibility into stacks and threads.

Signed-off-by: David Leach <david.leach@nxp.com>
2017-11-15 08:30:16 -06:00
Vincent Veron aff88a2249 drivers: spi: add 16 bits word size support for stm32
Add 16 bits support when using SPI in master mode.

Signed-off-by: Vincent Veron <vincent.veron@st.com>
2017-11-15 07:19:34 -06:00
Sebastian Bøe 780d9facbe cmake: s/CONFIG_I2C_STM32_V1x/CONFIG_I2C_STM32_V1/
Fix typo in build scripts for STM's I2C driver. The typo was
introduced in the cmake migration.

Discovered by Dmitry:
https://lists.zephyrproject.org/pipermail/zephyr-devel/2017-November/008383.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-15 07:06:26 -06:00
Jukka Rissanen 0436ad9e78 drivers: net: loopback: Simulate real hw device
Instead of passing net_pkt as is to the receiving side of the
interface, clone the sent packet and drop the sent one.
This is needed mainly in TCP where passing the same packet from
sending to receiving side is causing havoc.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-11-15 12:27:14 +02:00
Sebastian Bøe f2a3977261 cmake: Added missing zephyr_sources() calls for esp32 drivers
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-14 10:47:15 -05:00
Piotr Mienkowski bf74e5409b drivers: serial: fix CMakeLists for Atmel SoCs
- added missing usart_sam.c entry
- removed outdated uart_atmel_sam3.c entry

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-14 08:10:34 -05:00
Ding Tao 8fbbc13d20 CMake: Fix wrong file name of entropy_stm32.c
Signed-off-by: Ding Tao <miyatsu@qq.com>
2017-11-14 08:10:22 -05:00
Thiago Silveira 912a51957e drivers: entropy: Add nRF5 entropy generator driver
Origin: Original

Signed-off-by: Thiago Silveira <thiago@exati.com.br>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2017-11-14 07:02:12 -05:00
David Leach 513ce10da8 cmake: Fix build of entropy driver for MCUX TRNG
Signed-off-by: David Leach <david.leach@nxp.com>
2017-11-13 16:32:08 -05:00
Johann Fischer a14dd6309e cmake: fix build of the entropy drivers
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-11-11 19:01:42 -05:00
Sebastian Bøe 2224e22a6f drivers: sensor: Fixed include paths s/</"/
CMake no longer adds the source directory to the system include path.

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-10 11:21:41 -05:00
Sebastian Bøe 29bb2a8fbf cmake: Fixed drivers/sensor/CMakeLists.txt
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-10 11:21:41 -05:00
Gil Pitney dec93834d9 cmake: Fix drivers/serial/CMakeLists.txt to build uart_cc32xx.c
Previously, a typo prevented UART from working for any program
built for BOARD=cc3220sf_launchxl.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-11-09 22:01:34 -05:00
Loic Poulain eb83cda770 usb: dc_dw: Improve TX perf and reliability
During large USB transfer it's pretty common to call ep_write whereas
the previous TX transfer is not achieved and so the TX FIFO space is
not available. Sleeping 20ms in this case introduce a relatively high
latency and reduce the throughput.

This can be observed when pinging the board with CDC-ECM net class.
ping reply is split into 2 USB TX transfer, the second one is only
triggered after 20ms, making ping latency > 20ms.

To fix this, just continuously read the FIFO availabilty and fire TX
as soon as possible.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2017-11-09 09:15:55 -06:00
Loic Poulain fa2da6713b usb: stm32: Fix null dereference in ep_write
ret_bytes param is optional and then can be NULL.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2017-11-09 09:13:14 -05:00
Loic Poulain 4a2e967a87 usb: stm32: Fix TX FIFO overwrite
In the same way as dw driver, check that FIFO is empty before
writing any new data. This patch introduces a boolean semaphore
which is requested before any new TX transfer and released on
transfer completion.

This fixes usb-ecm support on 96b_carbon board.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2017-11-09 09:13:14 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
David B. Kinder 7e3ed1465f doc: fix Kconfig misspellings
Kconfig files are processed to create configuration
option documentation.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-11-08 13:50:35 -05:00
Gustavo Lima Chaves 9bb07ff69a jailhouse: add support for x2APIC mode for all LOAPIC accesses
Besides the fact that we did not have that for the current supported
boards, that makes sense for this new, virtualized mode, that is meant
to be run on top of full-fledged x86 64 CPUs.

By having xAPIC mode access only, Jailhouse has to intercept those MMIO
reads and writes, in order to examine what they do and arbitrate if it's
safe or not (e.g. not all values are accepted to ICR register). This
means that we can't run away from having a VM-exit event for each and
every access to APIC memory region and this impacts the latency the
guest OS observes over bare metal a lot.

When in x2APIC mode, Jailhouse does not require VM-exits for MSR
accesses other that writes to the ICR register, so the latency the guest
observes is reduced to almost zero.

Here are some outputs of the the command line

  $ sudo ./tools/jailhouse cell stats tiny-demo

on a Jailhouse's root cell console, for one of the Zephyr demos using
LOAPIC timers, left for a couple of seconds:

Statistics for tiny-demo cell (x2APIC root, x2APIC inmate)

COUNTER                              SUM   PER SEC
vmexits_total                          7         0
vmexits_management                     3         0
vmexits_cr                             2         0
vmexits_cpuid                          1         0
vmexits_msr                            1         0
vmexits_exception                      0         0
vmexits_hypercall                      0         0
vmexits_mmio                           0         0
vmexits_pio                            0         0
vmexits_xapic                          0         0
vmexits_xsetbv                         0         0

Statistics for tiny-demo cell (xAPIC root, xAPIC inmate)

COUNTER                              SUM   PER SEC
vmexits_total                       4087        40
vmexits_xapic                       4080        40
vmexits_management                     3         0
vmexits_cr                             2         0
vmexits_cpuid                          1         0
vmexits_msr                            1         0
vmexits_exception                      0         0
vmexits_hypercall                      0         0
vmexits_mmio                           0         0
vmexits_pio                            0         0
vmexits_xsetbv                         0         0

Statistics for tiny-demo cell (xAPIC root, x2APIC inmate)

COUNTER                              SUM   PER SEC
vmexits_total                       4087        40
vmexits_msr                         4080        40
vmexits_management                     3         0
vmexits_cr                             2         0
vmexits_cpuid                          1         0
vmexits_exception                      0         0
vmexits_hypercall                      0         0
vmexits_mmio                           0         0
vmexits_pio                            0         0
vmexits_xapic                          0         0
vmexits_xsetbv                         0         0

See that under x2APIC mode on both Jailhouse/root-cell and guest, the
interruptions from the hypervisor are minimal. That is not the case when
Jailhouse is on xAPIC mode, though. Note also that, as a plus, x2APIC
accesses on the guest will map to xAPIC MMIO on the hypervisor just
fine.

Signed-off-by: Gustavo Lima Chaves <gustavo.lima.chaves@intel.com>
2017-11-07 08:58:49 -05:00
Gustavo Lima Chaves 97a8716a4f x86: Jailhouse port, tested for UART (# 0, polling) and LOAPIC timer
This is an introductory port for Zephyr to be run as a Jailhouse
hypervisor[1]'s "inmate cell", on x86 64-bit CPUs (running on 32-bit
mode). This was tested with their "tiny-demo" inmate demo cell
configuration, which takes one of the CPUs of the QEMU-VM root cell
config, along with some RAM and serial controller access (it will even
do nice things like reserving some L3 cache for it via Intel CAT) and
Zephyr samples:

   - hello_world
   - philosophers
   - synchronization

The final binary receives an additional boot sequence preamble that
conforms to Jailhouse's expectations (starts at 0x0 in real mode). It
will put the processor in 32-bit protected mode and then proceed to
Zephyr's __start function.

Testing it is just a matter of:
  $ mmake -C samples/<sample_dir> BOARD=x86_jailhouse JAILHOUSE_QEMU_IMG_FILE=<path_to_image.qcow2> run
  $ sudo insmod <path to jailhouse.ko>
  $ sudo jailhouse enable <path to configs/qemu-x86.cell>
  $ sudo jailhouse cell create <path to configs/tiny-demo.cell>
  $ sudo mount -t 9p -o trans/virtio host /mnt
  $ sudo jailhouse cell load tiny-demo /mnt/zephyr.bin
  $ sudo jailhouse cell start tiny-demo
  $ sudo jailhouse cell destroy tiny-demo
  $ sudo jailhouse disable
  $ sudo rmmod jailhouse

For the hello_world demo case, one should then get QEMU's serial port
output similar to:

"""
Created cell "tiny-demo"
Page pool usage after cell creation: mem 275/1480, remap 65607/131072
Cell "tiny-demo" can be loaded
CPU 3 received SIPI, vector 100
Started cell "tiny-demo"
***** BOOTING ZEPHYR OS v1.9.0 - BUILD: Sep 12 2017 20:03:22 *****
Hello World! x86
"""

Note that the Jailhouse's root cell *has to be started in xAPIC
mode* (kernel command line argument 'nox2apic') in order for this to
work. x2APIC support and its reasoning will come on a separate commit.

As a reminder, the make run target introduced for x86_jailhouse board
involves a root cell image with Jailhouse in it, to be launched and then
partitioned (with >= 2 64-bit CPUs in it).

Inmate cell configs with no JAILHOUSE_CELL_PASSIVE_COMMREG flag
set (e.g. apic-demo one) would need extra code in Zephyr to deal with
cell shutdown command responses from the hypervisor.

You may want to fine tune CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC for your
specific CPU—there is no detection from Zephyr with regard to that.

Other config differences from pristine QEMU defaults worth of mention
are:

   - there is no HPET when running as Jailhouse guest. We use the LOAPIC
     timer, instead
   - there is no PIC_DISABLE, because there is no 8259A PIC when running
     as a Jailhouse guest
   - XIP makes no sense also when running as Jailhouse guest, and both
     PHYS_RAM_ADDR/PHYS_LOAD_ADD are set to zero, what tiny-demo cell
     config is set to

This opens up new possibilities for Zephyr, so that usages beyond just
MCUs come to the table. I see special demand coming from
functional-safety related use cases on industry, automotive, etc.

[1] https://github.com/siemens/jailhouse

Reference to Jailhouse's booting preamble code:

Origin: Jailhouse
License: BSD 2-Clause
URL: https://github.com/siemens/jailhouse
commit: 607251b44397666a3cbbf859d784dccf20aba016
Purpose: Dual-licensing of inmate lib code
Maintained-by: Zephyr

Signed-off-by: Gustavo Lima Chaves <gustavo.lima.chaves@intel.com>
2017-11-07 08:58:49 -05:00
Gustavo Lima Chaves 1a8e72c913 loapic_intr: factor (out) APIC accesses in static functions
This will accomodate newer access models later, with variations of those
functions' contents.

Signed-off-by: Gustavo Lima Chaves <gustavo.lima.chaves@intel.com>
2017-11-07 08:58:49 -05:00
Youvedeep Singh 833025dd94 timer: xtensa_sys_timer: Tickless Kernel Implementation for Xtensa
Implement Tickless Kernel support for Xtensa Architecture.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-11-07 08:17:40 -05:00
Bobby Noelte 2ce56e0100 drivers: serial: provide support for stm32f091
Support the USARTs of the ST STM32F091xx SoC.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2017-11-06 11:39:16 -06:00
Youvedeep Singh 26de2ec1cb gpio: Add APIs for enabling/Disabling GPIOTE interrupts for nrf52 SOC.
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-11-06 09:29:10 -05:00
Youvedeep Singh affbea7caf gpio: Add support for SENSE configuration for nrf SOC GPIO.
nrf SOCs are capable of waking from Low power state or
Deep Sleep state using sense configuration.
So adding support for this in nrf GPIO driver.

Jira: ZEP-2623

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-11-06 09:29:10 -05:00
Michael Hope 82118c712f net: fix the build rules for drivers/net.
The Makefile was using the obj-$FOO = form instead of the ob-$FOO +=
form, so if both slip and loopback are enabled then only loopback will
get built.

Signed-off-by: Michael Hope <mlhx@google.com>
2017-11-06 10:24:05 +02:00
Erwan Gouriou 2a7efb7419 sensors: hts221: 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
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
Harry Jiang 364a2ac8a1 sensor: lps22hb: fix the pressure sensor fractional value
Signed-off-by: Harry Jiang <explora26@gmail.com>
2017-06-06 22:31:10 -04:00
Andrei Emeltchenko f84d520088 drivers: IPM: Refactor IPM driver using u32_t registers
Refactor internals of IPM driver removing bitfields and byte access of
32 bit registers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-06-05 21:50:15 -04:00
Andrei Emeltchenko 1129925a62 drivers: IPM: Access 32-bit IPM registers right way
The current method of accessing 32-bit data and control registers does
not work for all quark architectures. Sometimes writing to those
registers byte-by-byte results in last byte occupying whole 32 bit
register.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-06-05 21:50:15 -04:00
Andrei Emeltchenko 50605ecba8 drivers: IPM: Fix loosing interrupts
Iterate inside ISR until we handle all events.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-06-05 21:50:15 -04:00
Florian Vaussard 13cba0bb76 stm32f4: Add STM32F412 Nucleo board
Add necessary board files, pinmux and device tree in order to have a
usable debug console.

Origin: Original

Change-Id: I43a9d278c3f2c936a714263626722f630367b663
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-06-02 14:11:13 -04:00
Erwan Gouriou 9413c8ba4d stm32: clean up after completion of transition to ll Clock control
Following migration of stm32f1xx series clock control driver to
STM32Cube LL API, cleanup stm32 code base in order to take into
account that this is the only clock driver available for stm32
family.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-06-02 14:11:13 -04:00
Erwan Gouriou f2e8a21d7f stm32f1xx: remove references to native driver
Following introduction of stm32cube LL based clock control driver,
remove references to former native driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-06-02 14:11:13 -04:00
Erwan Gouriou 78d74f4031 drivers: gpio stm32: set the ground for stm32f1x ll clock driver
Before introduction of LL based clock control for stm32f1xx series,
prepare gpio driver to provide useful definition for new API

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-06-02 14:11:13 -04:00
Erwan Gouriou e1a90583d4 drivers: clock_control: provide LL based driver to stm32f1xx series
Align stm32f1xx series clock driver to other parts of stm32 family.
Driver support both Connectivity and Density lines of stm32f1 series,
that are based on different Reset and Clock Control architectures.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-06-02 14:11:13 -04:00
Florian Vaussard 5ffb8d485a nucleo_f413zh: Add pinmux for PWM2_CH1
The Nucleo STM32F413 board is missing the default pinmux for PWM2 on
PA0, as stated in the doc. The same pinmux is also done for other
similar Nucleo board. So add it!

Change-Id: I2086c0a4ce65d68455a0978570f118e965f4c6ca
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-06-02 14:11:13 -04:00
Piotr Mienkowski dffc06ddd2 drivers: serial: deprecate usage of atmel_sam3 driver
Atmel SAM3X series has been recently converted to use ASF
and should now use common SAM family drivers. The atmel_sam3
serial driver will be removed in the future.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-06-02 14:11:13 -04:00
Vinayak Kariappa Chettimada 707500899d drivers: timer: Fix nRF RTC timer _timer_cycle_get_32
Fix nRF RTC timer from returning more than actual cycles
in _timer_cycle_get_32, under race condition when ISR
announces to kernel.

Jira: ZEP-2229

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-01 20:06:10 -04:00
Tomasz Bursztyka cced7fd47a api/spi: Change transceive functions signature
Instead of NULL terminated buffer arrays, let's add a parameter for each
that tells the number of spi_buf in it.

It adds a little bit more complexity in driver's side (spi_context.h)
but not on user side (bufer one has to take care of providing the NULL
pointer at the end of the array, now he requires to give the count).

This will saves a significant amount of bytes in more complex setup than
the current dumb spi driver sample.

Fix and Use size_t everywhere (spi_context.h was using u32_t).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-06-01 10:49:30 -04:00
Johan Hedberg 7574bebbfe drivers/display: mb_display: Use 4 ms refresh timer
The code was so far requesting 5 ms refresh timer, however with a
default TICKS_PER_SECOND=100 this was always rounded up to 10 ms,
causing some flickering. The closest TICKS_PER_SECOND that will give
flicker-less display but also give optimal ms-to-ticks calculations is
250, so change the timer to match that. After this change any code
using the display is recommended to set 250 as ticks per second.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-30 12:29:11 +03:00
Piotr Mienkowski b185f8617f watchdog: atmel_sam: enable build for all SAM family
atmel_sam watchdog driver was temporarily limited to SAME70
series only. Now that all SAM series are using ASF the
change can be reverted.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-05-28 09:18:54 -05:00
Paul Sokolovsky 58e8763009 drivers/ethernet/eth_mcux: Fix selection of promisc mode IPv6 workaround
Until we have better solution, we enable promiscuous mode as a
workaround to get IPv6 neighbour discovery going. Kconfig had
typos/thinkos preventing that to work however.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-25 15:09:46 -05:00
Johan Hedberg 9516d63836 Bluetooth: Remove support for NBLE
NBLE has been deprecated for a few releases now and can be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-25 09:03:16 -07:00
Paul Sokolovsky 8a3a569cd3 drivers/ethernet/eth_mcux: Fix extra PHY debug Kconfig name.
Source had CONFIG_ETH_MCUX_PHY_DETAILED_DEBUG, while Kconfig had
CONFIG_ETH_MCUX_PHY_EXTRA_DEBUG. Use the shorter name consistently.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-24 14:43:02 -05:00
Leandro Pereira 5315ee3122 drivers: spi_mcux_dspi: Fix unlikely but possible division by zero
Documentation doesn't specify if this function may return 0, so add an
inexpensive check to account for this.

Jira: ZEP-2135
CID: 160954
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-05-23 06:48:26 -05:00
Tomasz Bursztyka 649795a7cb drivers/spi: Handle SPI_HOLD_ON_CS in spi context through gpio
If CS is controlled over GPIO, it will be possible to keep the slave up
and running (though no transaction will be going on) using this
configuration bit.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Tomasz Bursztyka c2913ad025 drivers/spi: Handle ressource locking and release in DW driver
Again this is made as generic as possible through driver's
spi_context API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Tomasz Bursztyka 10c1e49f84 api/spi: Add 2 specific control bits for special use cases.
SPI_HOLD_ON_CS can be used to ask the SPI device to keep CS on, after
the transaction. And this undefinitely, until another config is used.
This will inhibate the gpio cs delay, if any. This might be useful when
doing consecutive calls on one slave without releasing the CS.

SPI_LOCK_ON is to be used with caution as it will keep the SPI device
locked for the current config being used after each transaction. This
can be necessary if one needs to do consecutive calls on a slave without
any olher caller to interfere.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Tomasz Bursztyka 587dd5d275 drivers/spi: Add support for async call in DW driver in a generic way
All is done through the generic spi_context driver's API as it will be
generic to all SPI drivers.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Tomasz Bursztyka 761a1d9429 api: Add asynchronous call support to SPI API
Adding a struct k_poll_signal parameter to driver's API unique
exposed function.

If not NULL, the call will be handled as asynchronous and will
return right after the transaction has started, on the contrary
of current logic where is waits for the transaction to finish
(= synchronous).

In order to save stack, let's move the device pointer to struct
spi_config. So the call is still at a maximum of 4 parameters.

Adapting spi_dw.c and spi driver sample to the change so it still
builts.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Tomasz Bursztyka b9838475ac drivers/spi: Handle synchronous calls in a generic manner in DW driver
All SPI drivers have this same way to handle synchronous call, thus
let's generalize it in struct spi_context, with a relevant API and apply
the change into SPI DW driver.

spi_context API will prove to be useful once asynchronous call will be
handled as well, through the same completion functions used now only for
synchronous call. It will be transparent for the driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Tomasz Bursztyka 0bd83d21f2 drivers/spi: Add reentrance support to DW driver in a generic manner
Let's improve common SPI driver context by adding a lock and generic
function to get/release it.

It's statically initialized to save a bit of ROM.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Tomasz Bursztyka 19b36aea0c drivers/spi: Adapt DW driver to new SPI API
Introducing as well a generic driver helper for CS gpio control and
buffer management.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Tomasz Bursztyka dd0c35919b api: New SPI API
Such API improves many aspects of the former API by reducing the number
of function, allowing more buffer flexibility etc... This leads in
better memory usag and performance as well.

However, as this will take sometime to get into use, the former API is
still present and is the one enabled by default.

Jira: ZEP-852
Jira: ZEP-287
Jira: ZEP-1725

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Tomasz Bursztyka 18991a2781 drivers/spi: Apply syntax rules on DW drivers
One liners if/for/while statements still need {}
(and line break are cheap for clarity).

Aligning parameters properly.

Also, removing __func__ usage from SYS_LOG_* as these macros already put
it internally.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-05-19 18:52:25 -04:00
Adithya Baglody 34ac008d0e drivers: pwm: remove deprecated PWM API usage.
Removed the old PWM APIs usage and added support for the new PWM API.

JIRA: ZEP-2018

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-19 18:38:01 -04:00
Piotr Mienkowski 36c0fddce7 drivers: eth_sam_gmac: Fix fragment ordering in RX
The data fragments were stored in reversed order when the RX
data was saved into network buffers. This was caused by net_pkt
changes in commit db11fcd "net/net_pkt: Fully separate struct
net_pkt from struct net_buf".

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-05-19 23:52:28 +03:00
Neil Armstrong a9183cd518 flash: Rework and add flash device support for STM32L4x SoCs
The STM32L4x SoCs embeds a slightly different embedded flash controller
from the STM32F4x SoCs.

This particular controller has the following properties :
 - Up to 2 512KiB banks divided in 2KiB pages
 - Flash can be accessed in any sizes
 - Flash must be written in 64bit aligned 64bit double-words

The drivers/flash/flash_stm32f4x.c is refactored into a new common
drivers/flash/flash_stm32.c and drivers/flash/flash_stm32l4x.c is
created with the STM32L4x specific functions.

To ease the refactoring and keep common functions, the STM32L4x flash
headers are slightly modified to match the hardware reference naming
and solve compilation issues.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-19 10:06:48 -04:00
Neil Armstrong 7a8452c38b flash_stm32f4: bits were badly unset in erase and write functions
A typo was present ion the erase and write function were bit were
uncorrectly unset but all other bit except the mask were unset.
The code still worked because the two typos fixed themselves.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-19 10:06:48 -04:00
Neil Armstrong 6da68d214e flash_stm32f4: RDERR is not present on STM32F407
The RDERR bit is not present on F4x5 and F4x7 SoCs, so only use it when
available in the HAL.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-19 10:06:48 -04:00
Piotr Mienkowski ba50782db2 drivers: uart_sam: Configure TX pins for SAME70 only
Limit visibility of configurable TX pins to SAME70 series only.
Previously visibility of configurable SAME70 TX pins extended
to the full SAM family.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-05-19 10:06:48 -04:00
Piotr Mienkowski ee66ee6c34 arch: sam3x: Use ASF library
This patch converts Atmel sam3x MCU series to use register
header files from Atmel Software Framework (ASF) library.
By using ASF different Atmel SAM MCU series can use common
device drivers.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-05-19 10:06:48 -04:00
Neil Armstrong 4a6ba84f67 boards: arm: Add support for STM32F469I-DISCO
Add board configuration, dts and pinmux based on the stm32f4_disco
board.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-19 10:06:48 -04:00
Kumar Gala 983e6a56fb arm: atmel: sam3: dts: use label to generate Atmel SAM3 uart name
Now that we can utilize label in the device tree we can convert to
getting the device name for the Atmel SAM3 UART out of the device
tree instead of from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-19 10:06:48 -04:00
Kumar Gala 22874ef301 arm: ti: stellaris: dts: use label to generate TI Stellaris uart name
Now that we can utilize label in the device tree we can convert to
getting the device name for the TI Stellaris UART out of the device
tree instead of from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-19 10:06:48 -04:00
Kumar Gala f13af29741 arm: ti: cc32xx: dts: use label to generate TI CC32xx uart name
Now that we can utilize label in the device tree we can convert to
getting the device name for the TI CC32xx UART out of the device
tree instead of from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-19 10:06:48 -04:00
Kumar Gala d88d4f90a5 arm: cmsdk_apb: dts: use label to generate ARM CMSDK APB uart name
Now that we can utilize label in the device tree we can convert to
getting the device name for the ARM CMSDK APB UART out of the device
tree instead of from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-19 10:06:48 -04:00
Kumar Gala a746bcd56d arm: nxp_kinetis: dts: use label to generate NXP Kinetis uart name
Now that we can utilize label in the device tree we can convert to
getting the device name for the NXP Kinetis UART out of the device tree
instead of from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-19 10:06:48 -04:00
Kumar Gala 29a6053a0d arm: nrf: dts: use label to generate NRF uart name
Now that we can utilize label in the device tree we can convert to
getting the device name for the NRF UART out of the device tree
instead of from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-19 10:06:48 -04:00
Kumar Gala bb2c32428b arm: stm32: dts: use label to generate STM32 uart name
Now that we can utilize label in the device tree we can convert to
getting the device name for the STM32 UART out of the device tree
instead of from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-19 10:06:48 -04:00
Neil Armstrong 84441b2ee4 arm: Add support for STM32F4DISCOVERY Board
Add configuration, documentation, flash script, pinmux and dts for the
STM32F4DISCOVERY board.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-19 10:06:48 -04:00
Neil Armstrong b729b478ec boards: arm: Add support for STM32L496G Discovery board
Add configuration, pinmux, dts and documentation for the STM32L496G
Discovery board based on the STM32L496AG SoC.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-19 10:06:48 -04:00
Kumar Gala 748f724d82 serial: dts: remove !HAS_DTS related Kconfig
As we now only support DTS for ARM based SoCs we can remove any
associated !HAS_DTS bits in Kconfig.  The Nordic NRF5 serial driver and
the ARM CMSDK APB serial drivers had Kconfig bits related to !HAS_DTS
builds.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-05-19 10:06:48 -04:00
Erwan Gouriou e015c00300 sensor: add lsm6dsl sensor driver
Support for LSM6DSL accelerometer and gyroscpe sensor
with bare minimum features.

For more info on this sensor:
http://www.st.com/en/mems-and-sensors/lsm6dsl.html

Change-Id: I9b100a3e030faa8a70a5015a881025c876b81be4
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-05-15 14:50:38 -05:00
Erwan Gouriou 411919661e sensor: lis3mdl: remove use of i2c_burst_write api
i2c_burst_write API implementation in some driver
and generate a sequence of messages that does not allow to
communicate with LIS3MDL sensor. This commit replaces use
of i2c_burst_write with a call to i2c_write, which enables
sensor configuration.
Meanwhile, description of LIS3MDL is completed in sensor
header file.

Change-Id: Ib1b4643365f3c70b31fbfc4b0c30cff294b475a3
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-05-15 14:50:38 -05:00
Erwan Gouriou 8ba04d595b sensors: add lps22hb sensor driver
Support for LPS22HB Pressure and temperature sensor provided
with bare minimum features.

For more info on this sensor:
http://www.st.com/en/mems-and-sensors/lps22hb.html

Change-Id: I14992b954053094beb054d0dba7581f6e29a3e68
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-05-15 14:50:38 -05:00
Florian Vaussard cad822ab52 pinmux: stm32f4: Add pinmux for more UARTs
Add defines and pinmux arrays to support more UARTs on STM32F4.

Change-Id: Ib06c549bdb2b3d7065554a0a6d1a3d15441b29c9
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-05-15 13:22:54 -04:00
Florian Vaussard a327de30cf serial: stm32: Add support for U(S)ART4/5/6/7/8/9/10
Add support for U(S)ART 4 to 10 that can be found at least on some
members of the STM32F4 family.

Change-Id: Ie870492511f885005cf023040e498bd4d800e807
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-05-15 13:22:54 -04:00
Florian Vaussard f27a5a3d6a serial: stm32: Use macro to simplify registration
The registration of each serial port differs only by a few details.
These differences can be factorized in order to create a generic
registration macro.

This has several advantages:
- Less code
- Easier to add new ports
- Less work to add support for new STM32 families

Change-Id: I6e62a96ccbbf03c9d51bc2617db6a851ff0d83c7
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-05-15 13:22:54 -04:00
Florian Vaussard 614db02cc6 stm32f4: Add STM32F413 Nucleo board
Add necessary board files, pinmux and device tree in order to have a
usable debug console.

Origin: Original

Change-Id: I280320700352fd36a544c03f4e57d2eeec2449e5
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-05-15 13:22:54 -04:00
Neil Armstrong 7df4b20af0 pinmux: stm32l4x: Fix USART 2 pinmux for nucleo-l432kc
The RX pin should be PA15 to use the Virtual COM port of the ST-LINK.

Also adds the missing entry in pinmux_stm32l4x.h.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-15 13:22:54 -04:00
Erwan Gouriou 9208d9f8db drivers: clock_control: fix AHB2 bus clock activation on stm32f4
During introduction of LL clock_control driver on stm32f4 series,
AHB2 clock activation/deactivation case was let under stm32l4 condition
preventing activation of this clock with F4 series.
This patch fixes the issue.

Change-Id: I5e488e990d33252f491f8960fc7a798ca3416be2
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-05-15 08:27:27 -05:00
Paul Sokolovsky 0fdc9b5b12 drivers: serial: Clarify usage of TX/RX IRQ predicates.
uart_irq_tx_empty() function proved to be problematic: its semantics
was not documented properly, and many hardware uses terminology like
"TX register empty" to signify condition of TX register being ready
to accept another character (what in Zephyr is tested with
uart_irq_tx_ready()). To avoid confusion, uart_irq_tx_empty() was
renamed to uart_irq_tx_complete(), propagating to drivers/serial
device methods.

The semantics and usage model of all of uart_irq_rx_ready(),
uart_irq_tx_ready(), uart_irq_tx_complete() is now described in
detail.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-13 10:57:31 -04:00
Carles Cufi 6c9e563c92 Bluetooth: Move common code to common/
Since more and more code is going to be reused by both the Host and the
Controller, this commit introduces a common/ folder that will contain
everything that is not tied to one of the two components but shared by
them.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-12 12:56:14 +03:00
Amit Kucheria b07baa687f drivers: spi: add nRF5 slave driver
SPIS driver for nRF51 and nRF52 SoCs.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Tyler Baker <tyler.baker@linaro.org>
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-11 22:35:28 -04:00
Andrew Boie 0d7962cee3 drivers: telnet_console: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie 27bcdc571b drivers: ieee802154: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie f21129180d gpio_sch: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie 2f9b147058 eth_enc28j60: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie b52a62b561 ipm_console_receiver: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie 899cf94dbd bluetooth: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie 33f80d7c85 drivers: sensor: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Max Filippov 6a89999787 xtensa: use inline assembly instead of XT_* macros
XT_* macros are defined in xtensa HAL headers as xcc intrinsics. gcc
does not have any of these intrinsics. Replace XT_* macros with inline
assembly or provide gcc-compatible definitions.

Change-Id: If823ea8a7898a11a3a8363b17efdba27dee4c6a4
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2017-05-11 16:51:56 -04:00
Marti Bolivar 15780bd542 clock_control: stm32: fix a PLL init corner case
Commit 58c8d15 ("clock control:stm32: provide STM32Cube LL based
driver") added PLL initialization which disables the PLL before
configuring it.

This works if the system clock source is not the PLL (which is the
usual case for Zephyr booting out of chip reset). However, if the
SYSCLK source *is* the PLL, this halts execution.

To support this use case, switch the SYSCLK source to the
always-present HSI before disabling the PLL.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-10 08:31:13 -04:00
Marti Bolivar cf05109c91 clock_control: stm32: factor out HSI switch code
Factor out a subroutine used to switch SYSCLK to HSI. This code will
be used again in a subsequent patch.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-10 08:31:13 -04:00
Carles Cufi 8a7eeeb7f1 Bluetooth: Move HCI driver debug to top-level Kconfig
Since the HCI driver debug option applies to both files in
drivers/bluetooth and subsys/bluetooth, the configuration option itself
now lives in the top-level Kconfig file for consistency.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-10 08:23:25 +03:00
Kumar Gala c11877941a drivers: ieee802154_kw41z: 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-05-09 17:06:28 -04:00
Kumar Gala 4147ad03e3 drivers: eth_dw: 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-05-09 17:06:28 -04:00
Neil Armstrong e844ca9e4f pinmux: stm32: Add support for Nucleo L432KC
Add pinmux configuration for the Nucleo L432KC board

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-08 15:03:15 -04:00
Neil Armstrong 89bc20dfa7 pinmux: stm32: Do not compile PORTD when not available
The STM32L432 does not have a PORTD gpio, disable it when not available.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-08 15:03:15 -04:00
David B. Kinder f930480e16 doc: misspellings in Kconfig files
fix misspelling in Kconfig files that would show up in configuration
documentation and screens.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-05-05 19:38:53 -04:00
Bogdan Davidoaia 15e55e1823 ieee802154: kw41z: keep global transceiver interrupt unmasked
There is no need to unmask/mask the global transceiver interrupt
in kw41z_start/stop as the radio interrupt line is enabled/disabled
anyway with irq_enable/disable calls.

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-05-04 11:58:46 -04:00
Bogdan Davidoaia cbe030d444 ieee802154: kw41z: fix sync issue in CCA sequence
- set state to IDLE if TMR1 expires, but CCA reports channel as free
- no need to check for CCABFRTX, as the hardware isn't setup to do
CCA before TX

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-05-04 11:58:46 -04:00
Bogdan Davidoaia 5dc68e3855 ieee802154: kw41z: adjust sequence timeouts
Sequence timeouts should be scaled to 16us, as TMR_PRESCALE was set
to 62.5kHz.

Also, radio warmup times and TX packet length need to be taken into
account.

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-05-04 11:58:46 -04:00
Leandro Pereira 1c4b09947f drivers: eth_dw: Port to new IP stack
The main difference to how the previous driver operates, is that this
version has zero-copy transmission.  The transmit DMA descriptor is
updated for every fragment that is transmitted from the driver.

Another difference in the transmission path is that this version won't
spin indefinitely while waiting for the DMA transfer to complete; an
arbitrary number of busy checks (20) will be performed, and then
the transmission thread will yield for as long as necessary to finish
the transfer.

These two changes should fix ZEP-472; since that issue was opened for
an older version of Zephyr with uIP, I did not bother going all the way
back to test.

This has been only tested with a Galileo board, using Shared IRQ.

Jira: ZEP-1652
Jira: ZEP-472
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-05-04 11:57:22 -04:00
Paul Sokolovsky 2506e2738e stm32: Don't perform any side effects in irq_update().
The purpose of irq_update() is to cache value of UART IRQ status
register for devices which needs such caching. No other driver
performs any other side effects in this call. For STM32, clearing
TC (tx complete) bit was introduced in 8c079e91c9
which is otherwise titled as a conversion to STM32Cube HAL. Thus,
there does not seem to be specific reasons why this code was added.
On the other hand, it leads to behaviorial artifacts when dealing
with interrup-driven UART code (specific issue seen was delaying
of transmitting every other character).

Change-Id: Id20bf214b36eeb6c09e29cc2e6bfca4f7221a1a4
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-04 09:48:08 -05:00
Roger Lendenmann 0bc4a88bc7 sensor: lis2dh: Add support for lis2dh accelerometer
* lis2dh 3 axis accelerometer support on SPI and I2C bus
 * data ready and anymotion type of trigger support

 Tested on Dynastream module D52QD2M4IA-A using SPI

Origin: based on Zephyr lis3dh driver

Change-Id: I2c4e9418b87f09c957bba8f73522bd78830bc809
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
2017-05-04 09:39:46 -04:00
Johan Hedberg 70e09b11ea Bluetooth: Introduce buffer type parameter to bt_buf_get_rx
This is preparation for re-introducing host flow control.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-04 16:38:34 +03:00
Justin Watson 558281b096 arch: sam3x: update Kconfig options after move to SAM SoC family tree
The files for the Arduino Due needed to be updated to use the new
configuration when the SoC moved from the atmel_sam3 directory to
the atmel_sam/sam3x directory.

Jira: ZEP-2067

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-03 13:51:37 -04:00
Jon Medhurst 1c1507d4cd i2c: i2c_sbcon: Driver for ARM's SBCon 2-wire serial interface
SBCon is a simple device which allows directly setting and getting the
hardware state of two-bit serial interfaces like I2C. Therefore to be
useable we need to drive the lines with the appropriate protocol under
software control.

Change-Id: If9000bb75f7b0ad7bbb256b1cb38cc70fa6ca8ea
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-05-03 13:51:37 -04:00
Andrei Emeltchenko cdbae26ac5 ipm: Trivial space adjustment
Change-Id: I3182c2df5ffc9e2b6f1fc0d1ed4b401b030b9711
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-05-03 10:25:29 -04:00
Adithya Baglody d03b2496cd test: benchmarking: Timing metrics for the kernel
JIRA: ZEP-1822, ZEP-1823, ZEP-1825

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-03 08:46:30 -04:00
Piotr Mienkowski 068766f7be drivers: i2c: clean up Kconfig file
Several minor changes to clean up I2C Kconfig file
- align help text
- remove duplicate dependencies
- use unified naming for I2C port options
- replace outdated references to datasheet in help text
- add comments at the end of 'endif'

Change-Id: I452083feb29f40909e6e38324ff9d9961fc6bd07
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-29 11:48:08 -04:00
Johan Hedberg 97f0241c07 Bluetooth: Fix alignment issues resulting from new integer types
The switch from C99 integer types to u16_t, etc. caused misalignment
in structs and function definitions with multi-line parameter lists.

Change-Id: Ic0e33dc199f834ad7772417bca4c0b2d2f779d15
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-29 11:39:13 -04:00
Kumar Gala c40239dcfa watchdog: atmel_sam: only build for SAME70
With recent changes we now have both SAME70 and SAM3X under
SOC_FAMILY_SAM so we need to limit the watchdog driver only to SAME70 as
it only builds there right now.

Change-Id: I4a7c90247ad22532b2384ca536cfb0cbd65186f9
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-28 21:49:45 +00:00
Kumar Gala ac0bb050dd arm: dts: ti_lm3s6965: Add device tree support for Stellaris UART
Converted Stellaris UART driver over to utilize device tree generated
defines.  Added a yaml description for the uart, and converted over the
ti_lm3s6965 SoC & qemu_cortex_m3 board port over to utilize it.

Change-Id: Ie20844eb63d2c68eb59ad4160f7f5b5a35e2943b
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-28 15:26:40 -05:00
Kumar Gala 749e02f6ea serial: uart_stellaris: remove export of uart_stellaris_isr
There isn't any reason to export the uart_stellaris_isr function, so
lets make it static and remove the associated header file.

Change-Id: I3a131b584d9d6fb6279a1503512668a71510dd4d
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-28 15:26:40 -05:00
Jon Medhurst 5b04bd9aa4 i2c: i2c_gpio: Driver for software driven I2C using GPIO lines
This driver implements an I2C interface by driving two GPIO lines under
software control.

Change-Id: Ie49cc67aed6acb30086ee851041fe2470da241cf
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-04-28 15:26:40 -05:00
Jon Medhurst 0818564753 i2c: bitbang: Add library for software driven I2C
This library implements the I2C single master protocol in software.
It supports the Standard-mode and Fast-mode speeds and doesn't support
optional protocol feature like 10-bit addresses or clock stretching.

Change-Id: I375d572a83714522421f2967dc414b3bec169e95
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-04-28 15:26:39 -05:00
Florian Vaussard 392803e4cc pinmux: stm32f4: Clean-up pinmux header
Clean-up the pinmux header as a preparatory work before adding more
pinmuxes.

This is achieved by the following two actions:
- Reorder the defines by increasing GPIO order to make it
  easier to add more pinmux over time while avoiding a huge mess
- Use tabs to align

Change-Id: I07d9ae28f61287748d33dcf638dcbf2e6865517b
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-04-28 15:26:39 -05:00
Erwan Gouriou 2e20577554 board: Add support for board disco_l475_iot1
This commit provides support for disco_l475_iot1 board
Pinmux driver is provided with initial support definitions

Change-Id: I17b637a8ba0b033014969eca8fffe76319c47c52
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-28 15:26:39 -05:00
Kumar Gala ed467a695a serial: mcux: Shim driver for LPSCI UART on KL25Z
Adds a shim layer around the mcux lpsci driver to adapt it to the Zephyr
serial interface.

Change-Id: I024f1605e3194f34bb57e8a121900e05b3085a82
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-28 15:26:38 -05:00
Erwan Gouriou 288a9c145d driver: clock control stm32: align f4 factor names on l4
This commits align CONFIG_ factor names between stm32f4 and stm32l4
series to enable code factorization such as use of Q_DIVISOR.
Though, it does not concatenate kconfig sections as we might use
a bit of time to see what is needed in this regard

Change-Id: Ia603406d53949abf5675b801a5448397d5ab8462
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-28 15:26:37 -05:00
Erwan Gouriou 424c33825c driver: uart: clock control code refactoring
Small code refactorisation in order to ease up coming
support of stm32f1 series by stm32 commom clock control
driver

Change-Id: I486cfba137cd048d65f0732e10aa29d877bb03e5
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-28 15:26:11 -05:00
Erwan Gouriou 242ed389a3 stm32f4: Clean references to stm32f4 specific clock control
Following activation of stm32 common clock driver for stm32f4 series
remove references to stm32f4 specific driver.

Change-Id: I372a0ea046007bcb34944d6b2b8880077583b1d3
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-28 15:26:11 -05:00
Erwan Gouriou 9e558fc05a drivers: dma_stm32f4x: make driver compatible with LL Clock Driver
Following update of LL clock driver to suport F4 series,
update dma driver to support LL clock driver API.

Change-Id: Ic8ecfe4f33109204f3b5f8c22bcb9c41de81531d
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-28 15:06:41 -05:00
Erwan Gouriou fda01e52c2 drivers: clock control: Provide LL based clock control for stm32f4 series
This commit enables STM32Cube LL based driver for stm32f4 series.
This generic driver provides a unified API to clock driver for all
stm32 series.
LL API allows driver to be lightweight and to keep genericity across
stm32 family to ease further devlopment and maintenance.

Change-Id: Ie31ae8f433313787f9c9eda77de41925721d54dd
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-28 15:06:41 -05:00
Erwan Gouriou 9bd2a42d60 dts: Align uart "baud-rate" property to device tree spec "current-speed"
Devicetree.org specifies that serial devices property used to set
baud rate is "current-speed", while zephyr uses "baud-rate".
Align property name in order to keep zephyr dts files compatible
with device tree specification and could be re-used from/to
Linux for instance.  We also cleanup a few SoCs that set "baud-rate" in
the SoC dts and not the board.

Jira: ZEP-2048

Change-Id: I097e7439ee46fe77c628b56531772950382fafcc
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-28 15:06:40 -05:00
Bogdan Davidoaia 90e0665190 net: ieee802154: add native IEEE 802.15.4 driver for KW41Z
The driver uses KW41Z's IEEE 802.15.4 hardware registers (ZLL).

Origin: Original

Jira: ZEP-2026
Change-Id: I8eb82a7c16c8ca3e3003f8318f74a3651eb24f68
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-04-28 15:01:10 +03:00
Jukka Rissanen 7b3148e780 drivers/eth/mcux: Fix the fragment ordering in RX
The data fragments were stored in reversed order when the RX
data was saved into network buffers. This was caused by net_pkt
changes in commit "net/net_pkt: Fully separate struct net_pkt
from struct net_buf".

Change-Id: I8ad2cfc23b2cb90896b0548eab168895b0d7421d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28 15:01:09 +03:00
Paul Sokolovsky 25307d5331 net: net_pkt_append: Refactor to return length of data actually added
For stream-based protocols (TCP), adding less data than requested
("short write") is generally not a problem - the rest of data can
be sent in the next packet. So, make net_pkt_append() return length
of written data instead of just bool flag, which makes it closer
to the behavior of POSIX send()/write() calls.

There're many users of older net_pkt_append() in the codebase
however, so net_pkt_append_all() convenience function is added which
keeps returning a boolean flag. All current users were converted to
this function, except for two:

samples/net/http_server/src/ssl_utils.c
samples/net/mbedtls_sslclient/src/tcp.c

Both are related to TLS and implement mbedTLS "tx callback", which
follows POSIX short-write semantics. Both cases also had a code to
workaround previous boolean-only behavior of net_pkt_append() - after
calling it, they measured length of the actual data added (but only
in case of successful return of net_pkt_append(), so that didn't
really help). So, these 2 cases are already improved.

Jira: ZEP-1984

Change-Id: Ibaf7c029b15e91b516d73dab3612eed190ee982b
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28 15:01:09 +03:00
Piotr Mienkowski 65d5e8b2ad drivers: eth_sam_gmac: support reading MAC from I2C EEPROM
This patch adds support for reading MAC address from I2C EEPROM.
Only chips with 7-bit I2C device address are supported.

Change-Id: Ibedc33e54e33bdb901840e104063e2f4752b9123
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-28 15:01:08 +03:00
Piotr Mienkowski b996517b5e drivers: eth_sam_gmac: clean up after net_nbuf to net_pkt change
Change-Id: If3aa621b2cc98df4e379dddec6307cbdfb1ed355
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-28 15:01:08 +03:00
Ruslan Mstoi dfffe4b963 drivers: slip: escape SLIP special characters in headers too
Otherwise they are send as is and stripped by tunslip6, resulting in
malformed packets.

Jira: ZEP-2037

Change-Id: I1267b9ac956f3cd7aa3456ce20447ef97281d7a8
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2017-04-28 15:01:08 +03:00
Paul Sokolovsky abf284e9fd Revert "serial: stm32: Give H/W a chance to set the TXE bit on transfer"
Don't busy-wait in uart_stm32_fifo_fill(), this routine is supposed
to be called on IRQ, and the waiting loop was shown to interfere
with interrupt-driven UART handling.

The original problem mentioned in the patch being reverted ("it is
possible to evaluate the TXE bit *before* H/W has had the
opportunity to detect that data is being processed") may still
exist and may require handling in a different way. The most obvious
way is to replace "while" loop with "if", because STM32 doesn't
have multi-level FIFO anyway. But I was dissuaded to include such a
change as part of this patch, so it's left for future analysis.

This reverts commit 49c2858d94.

Change-Id: Ib27b53ba3a29b84c1a2dccff6d33f4118680cc19
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-27 15:19:59 +00:00
Ramesh Thomas b414cc56f5 timer: tickless: arcv2: Add tickless kernel support
Add tickless kernel support. Sets timer always in one
shot mode to the time the kernel scheduler needs the
next timer event. Uses mili seconds as the scheduling
time unit.

Jira: ZEP-1817
Change-Id: Ia2e63711cdd9d7d9c241b9ff08a606aa79575012
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:32 +00:00
Ramesh Thomas 0beffbe6be timer: tickless: cortex_m: Add tickless kernel support
Add tickless kernel support. Sets timer always in one
shot mode to the time the kernel scheduler needs the
next timer event. Uses mili seconds as the scheduling
time unit.

Jira: ZEP-1818
Change-Id: I21ce037b571c4c6ff588033a15aa49624cba7a57
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:31 +00:00
Ramesh Thomas 74ecc24976 timer: tickless: loapic: Add tickless kernel support
Add tickless kernel support. Sets timer always in one
shot mode to the time the kerneel scheduler needs the
next timer event. Uses mili seconds as the scheduling
time unit.

Jira: ZEP-1816
Change-Id: I85232b572759b9653c6396edc057ff4409525c97
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:30 +00:00
Ramesh Thomas e314ea3819 timer: tickless: hpet: Add tickless kernel support
Update the timer to use the tickless kernel interface
provided by kernel to operate in event based mode. In
this mode, the timer would not generate periodic ticks
and would only be programmed in one shot mode. It would
announce elapsed time in wall time units instead of
ticks. Timer can also be disabled enabling waiting
forever for a non-timer event.

Jira: ZEP-1812
Change-Id: I13110b9fb53b33a9244cc91a3d991f8452d330b1
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:29 +00:00
Ramesh Thomas 89ffd44dfb kernel: tickless: Add tickless kernel support
Adds event based scheduling logic to the kernel. Updates
management of timeouts, timers, idling etc. based on
time tracked at events rather than periodic ticks. Provides
interfaces for timers to announce and get next timer expiry
based on kernel scheduling decisions involving time slicing
of threads, timeouts and idling. Uses wall time units instead
of ticks in all scheduling activities.

The implementation involves changes in the following areas

1. Management of time in wall units like ms/us instead of ticks
The existing implementation already had an option to configure
number of ticks in a second. The new implementation builds on
top of that feature and provides option to set the size of the
scheduling granurality to mili seconds or micro seconds. This
allows most of the current implementation to be reused. Due to
this re-use and co-existence with tick based kernel, the names
of variables may contain the word "tick". However, in the
tickless kernel implementation, it represents the currently
configured time unit, which would be be mili seconds or
micro seconds. The APIs that take time as a parameter are not
impacted and they continue to pass time in mili seconds.

2. Timers would not be programmed in periodic mode
generating ticks. Instead they would be programmed in one
shot mode to generate events at the time the kernel scheduler
needs to gain control for its scheduling activities like
timers, timeouts, time slicing, idling etc.

3. The scheduler provides interfaces that the timer drivers
use to announce elapsed time and get the next time the scheduler
needs a timer event. It is possible that the scheduler may not
need another timer event, in which case the system would wait
for a non-timer event to wake it up if it is idling.

4. New APIs are defined to be implemented by timer drivers. Also
they need to handler timer events differently. These changes
have been done in the HPET timer driver. In future other timers
that support tickles kernel should implement these APIs as well.
These APIs are to re-program the timer, update and announce
elapsed time.

5. Philosopher and timer_api applications have been enabled to
test tickless kernel. Separate configuration files are created
which define the necessary CONFIG flags. Run these apps using
following command
make pristine && make BOARD=qemu_x86 CONF_FILE=prj_tickless.conf qemu

Jira: ZEP-339 ZEP-1946 ZEP-948
Change-Id: I7d950c31bf1ff929a9066fad42c2f0559a2e5983
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:28 +00:00
Tomasz Bursztyka dc646b5f2e drivers/crypto: Fix a memory leak in tc shim driver
If setting up crypto context fails enough times, the sessions will all
end up "in use" though they will not. This will lock tc shim driver
altogether and no crypto context will be possible to run on it.

Change-Id: I72346854e52294f96afc32f30ac5bfd0c368812b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:34 +00:00
Tomasz Bursztyka aec8a03877 drivers/crypto: Use crypto init Kconfig option for tc shim driver
Instead of generic kernel init priority option.

Change-Id: I5b6ed89fdc9528b96f08b4368364256fa79d9c60
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:33 +00:00
Tomasz Bursztyka 4fdbac15cd drivers/crypto: Make tc shim number of sessions Kconfig based
Thus it is possible to reduce or raise such amount relevantly if
required.

Change-Id: Ib53131e10e69fcbf1bcd9d844703d5b8832ee224
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:32 +00:00
Tomasz Bursztyka bfc7fb5ea4 drivers/crypto: Use sys_log automatic newline addition in tinycrypt shim
All existing log entries add a line break, so let's just use the sys_log
way.

Change-Id: Ia94efa593700e9590e16b51262f0b5a2fe10ffa2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:32 +00:00
Tomasz Bursztyka 5296cd2060 drivers/crypto: Prefix source code relevantly
As everywhere else in drivers, domain of driver should be used as name
prefix.

Change-Id: I1bb2284495c7a6b2648395b757a5f912e4410b15
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:31 +00:00
Tomasz Bursztyka 070194b816 drivers/crypto: Make ataes132a's Kconfig following syntax rules
As it is a crypto driver, let's prefix all options with CRYPTO_ as it is
done everywhere else.

Change-Id: I1eccbf655417664a1f031a221081b0b1db673394
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:30 +00:00
Tomasz Bursztyka 0b5946e4b7 drivers/crypto: Use a proper driver name for TinyCrypt shim driver
Change-Id: I526677c98fa70e46f92dbb4e4569707e1cb8469a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:29 +00:00
Tomasz Bursztyka 493ffdf7cb drivers/Kconfig: Cleanup Kconfig
- help message should have same intendation on a specific file
- No need of "depends on" if it's already in a relevant if/endif
- either prompt is used, or not, but let's not mix.

Change-Id: Ib75f25dcf2440fd0ba7bde5c95bc1fbece68be07
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:29 +00:00
Erwan Gouriou 933e39d2a8 sensor: lsm6ds0: fix copy/paste error
LSM6DS0 kconfig option refers to LIS3MDL sensor.
This commit fixes the issue.

Change-Id: I2867973064389cc745fcd5636e65916fcbc0ea40
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-25 19:27:22 +00:00
Adithya Baglody 23d946f4c0 drivers: console: Do not wait on the DTR signal from the host USB controller.
Jira: ZEP-1993
Change-Id: I4834d630f245f81381887af56e2d6ccd811094b4
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-04-25 02:33:01 +00:00
David B. Kinder 3561c73ece spell: Kconfig help typos: /arch
Fix misspellings in Kconfig help text and made spelling of
RX and TX consistent (from reviewer comments)

Change-Id: Ie9d4c3863cd210e7a17b50a85a7e64156b6bf3d7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-24 20:14:53 +00:00
David B. Kinder 93e4d7258d spell: fix Kconfig help typos: /boards /drivers
Fix misspellings in Kconfig help text

Change-Id: I3ae28a5d23d8e266612114bc0eb8a6e158129dc7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-21 21:31:30 +00:00
Kumar Gala cc334c7273 Convert remaining code to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.  This handles the remaining includes and kernel, plus
touching up various points that we skipped because of include
dependancies.  We also convert the PRI printf formatters in the arch
code over to normal formatters.

Jira: ZEP-2051

Change-Id: Iecbb12601a3ee4ea936fd7ddea37788a645b08b0
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 11:38:23 -05:00
Tomasz Bursztyka d2b5853cd9 drivers/gpio: Use ifdef relevantly in DW drivers
Change-Id: I580ca0aeccd7b2c1117fc71571dac9faa5baf8b0
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 16:34:53 +00:00
Tomasz Bursztyka e9e78878d0 drivers/spi: Get QMSI shim driver following syntax rules
Even one liner if () should have get { ... }

Change-Id: I7f9d8d74398286e97549bed050e29d4d175e1b02
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 16:34:52 +00:00
Kumar Gala ccad5bf3e3 drivers: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 10:06:48 -05:00
Kumar Gala a509441210 net: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:30:38 -05:00
Tomasz Bursztyka db11fcd174 net/net_pkt: Fully separate struct net_pkt from struct net_buf
- net_pkt becomes a stand-alone structure with network packet meta
  information.
- network packet data is still managed through net_buf, mostly named
  'frag'.
- net_pkt memory management is done through k_mem_slab
- function got introduced or relevantly renamed to target eithe net_pkt
  or net_buf fragments.
- net_buf's sent_list ends up in net_pkt now, and thus helps to save
  memory when TCP is enabled.

Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka bf964cdd4c net: Renaming net nbuf API to net pkt API
There have been long lasting confusion between net_buf and net_nbuf.
While the first is actually a buffer, the second one is not. It's a
network buffer descriptor. More precisely it provides meta data about a
network packet, and holds the chain of buffer fragments made of net_buf.

Thus renaming net_nbuf to net_pkt and all names around it as well
(function, Kconfig option, ..).

Though net_pkt if the new name, it still inherit its logic from net_buf.
'
This patch is the first of a serie that will separate completely net_pkt
from net_buf.

Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Kumar Gala d0eb235510 Bluetooth: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I8f57a17f78e674aca5400f005db8975c9f9e150e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 13:25:23 -05:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
David B. Kinder 896cf7a00a spell: fix doxygen comment typos: /drivers
Fix doxygen comment typos used to generate API docs

Change-Id: I6fd5051c99bdcc731740c92001e525349c254d85
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-19 10:45:34 -07:00
Kumar Gala 8814f4f7b4 Revert "drivers/sensor: Convert formatter strings to use PRI defines"
This reverts commit e60af3be66.

We revert this as we intent to move away from {u}int{8,16,32,64}_t types
to our own internal types for sized variables so we shouldn't need the
PRI macros anymore.

Change-Id: I4a57eb2c23cb1b137112224f604602d40c7cce4f
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 10:50:51 -05:00
Anas Nashif 306e15e0a1 kernel: remove legacy kernel support
Change-Id: Iac1e21677d74f81a93cd29d64cce261676ae78a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 15:48:37 +00:00
Kumar Gala e60af3be66 drivers/sensor: Convert formatter strings to use PRI defines
To allow for various libc implementations (like newlib) in which the way
various {u}int{8,16,32}_t types are defined vary between both libc
implementations and across architectures we need to utilize the PRI
defines.

Change-Id: I69e60e3823028389b314adaf6e279fd47fde1182
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-17 11:09:36 -05:00
Piotr Mienkowski 34c16ad2f7 drivers: Add Atmel SAM serial (UART) driver
Added serial (UART) driver for Atmel SAM MCU family.

Note:
- Error handling is not implemented
- The driver works only in polling mode, interrupt mode is
  not implemented.

Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-1959
Change-Id: I3e770fd1feb2ddf92cf405a9aa17be92eb32e19b
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-14 05:56:54 -05:00
Piotr Mienkowski 5c83e3817d drivers: Add Atmel SAM family I2C (TWIHS) driver
Added I2C bus (TWIHS) driver for Atmel SAM MCU family. Only
I2C Master Mode with 7 bit addressing is currently supported.

Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-1866
Change-Id: Ic5aa7b6b21295feccae883d580b38bbeaf2ce291
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-14 05:56:54 -05:00
Kumar Gala 77f65b907f arm: dts: Add DTS support for NRF52832 SoC
Add plumbing to build system and SoC level dtsi for the NRF52832 SoC.
We additionally add the necessary yaml files for the UART on the NRF52
SoCs.

Change-Id: I3b4a821b2993827e33d8e84bdbbc759d1521f8bd
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 05:56:54 -05:00
Gustavo Denardin 4951340829 arm: GPIO driver modifications for MKL25Z soc support
The MKL25Z soc do not support irqs in PORTB, PORTC and PORTE.
This is a patch to not enable irq if such ports are enabled.

Change-Id: I7b0b308504fcea47714fee8f2913baf336c4aa7d
Signed-off-by: Gustavo Denardin <gustavo.denardin@gmail.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 05:56:53 -05:00
Erwan Gouriou 5033bb3ce2 drivers: pinmux: stm32l4 fix
Fix missing define following recent file clean up.

Change-Id: I6ec64098b91324f50c035f410fa3e1beb9aface4
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-14 05:56:53 -05:00
Kumar Gala 621ba596b9 serial: stm32: remove bits related to !HAS_DTS
Now that all STM32 platforms are using device tree we can remove the
handling for !HAS_DTS from the serial driver.

Change-Id: Ifafc283f2509dd9a438f321e0b647720d4f13810
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 05:56:53 -05:00
Kumar Gala 27d74d8ad2 serial: mcux: remove bits related to !HAS_DTS
Now that all NXP MCUX platforms are using device tree we can remove the
handling for !HAS_DTS from the serial drivers.

Change-Id: I05185142afa7fae83ce68de954202829868af88f
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 05:56:53 -05:00
Erwan Gouriou b8297e8fb8 drivers: i2c: stm32: fix i2c_2 instance config
Wrong base address has been provided to I2C_2 instance.
Fix this issue for proper behavior

Change-Id: I81e5cb71a5136e742f460db5db39b2adf2f10f2d
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-14 05:56:53 -05:00
Piotr Mienkowski a8de9ff438 drivers: i2c: rename IRQ SHARED/DIRECT Kconfig options
I2C_SHARED_IRQ, I2C_0_IRQ_SHARED, I2C_0_IRQ_DIRECT Kconfig options
are DW driver specific. Its presence is confusing for a user of any
other I2C driver than DW. This patch renames these options to include
DW string and makes it visible only for DW I2C driver. This is a
similar implementation to that used by ETH DW Ethernet driver.

Change-Id: I795506f9b103c028a22317df9ad632dce5cd1343
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-14 01:58:33 +00:00
Vinayak Chettimada 9584456fc9 drivers: pwm: Add nRF5x GPIOTE based PWM driver
Add support for nRF5x series GPIOTE based PWM driver
implementation.

Provides upto 3 pins/channels using one HF timer, two PPI
channels per pin, and one GPIOTE config per pin.

Change-id: I6056b199ec2cff595ba8fea9f659a0338ed4635b
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-14 01:53:07 +00:00
Carles Cufi 81c52a15d2 drivers: gpio: nrf5: Fix interrupt enable and disable
Correct the way interrupts are enabled and disabled using the INTENSET
and INTENCLR registers, which ignore all 0s written to them and are both
positive registers.

Change-Id: I052548b0255d9d5ae36b2a708ed1968ae3ab1d06
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-04-14 01:51:43 +00:00
Anas Nashif d3af7f75c9 Merge "Merge net branch into master" 2017-04-14 01:43:34 +00:00
Michael R Rosen ce4f942011 flash: enable flash bank 1 for arc on quark se c1000
Change-Id: Ide95d7f21290b1effb759b1f2e7a014ce21ef1bf
Signed-off-by: Michael R Rosen <michael.r.rosen@intel.com>
2017-04-14 01:35:40 +00:00
Max Filippov 0ad868a58c xtensa_sim_console: fix simcall
simcall must be in the volatile asm so that gcc does not optimize it
out. It also needs "memory" clobber to make sure data passed through
memory buffer is actually written back before the simcall.

Change-Id: I410b7348bf605d0d08f81ec5395f6cb144f33a43
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2017-04-13 20:33:27 +00:00
Tomasz Bursztyka feaa1e1371 drivers/ieee802154/cc2520: Set the current rx frame RSSI into its nbuf
Change-Id: I215a8ceaa066a8521a2f647746301dbec780b43f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-13 15:21:45 +03:00
Piotr Mienkowski 323db1e366 drivers: eth_sam_gmac: Make sure not to leak net_buf in RX
Check net_recv_data() return value, if it returns an error release
the net_buf. Based on a fix in eth_mcux driver.

Change-Id: I44ca5fd8dfb7175620b7e8850a68443100039db6
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-13 15:21:43 +03:00
Patrik Flykt bd75219ba0 crc16: Create function for computing CRC 16
Add the simplest possible CRC 16 function that computes the CRC value
without the help of lookup tables.

Change-Id: I9163389adaa4a70c4e8ce8ce6d5f0661f40c7871
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2017-04-13 15:21:42 +03:00
Jukka Rissanen 909069d2c7 drivers/eth/mcux: Make sure not to leak net_buf in RX
Check net_recv_data() return value and if it returns an error
then release the net_buf in order to avoid leaking it.

Coverity-CID: 158884

Change-Id: I10d411a2de4b7c7bbe2475df65d93f5b1e619679
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:41 +03:00
Anas Nashif fdd045b52b kconfig: rename non-Kconfig CONFIG_* variables
CONFIG_* usually come from Kconfig, rename variables that are locally
defined to avoid confusion about where they are set.

Change-Id: I83b8459913c5deb68dc1b9f5386b8934363a6d1f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-11 03:14:23 +00:00
Anas Nashif b84dc2e124 kernel: remove all remaining references to nanokernel
Change-Id: I43067508898bc092879f7fe9d656ccca6fd92ab2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 20:21:10 +00:00
Anas Nashif d7bc60f096 kernel: remove remaining microkernel references
Change-Id: Ie648dbaaf714316c21395bd43e555618013dbd19
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 20:21:05 +00:00
Anas Nashif df60826037 sensor: hp206c: sensor does not support trigger
That option was not defined and the sensor does not have this feature,
probably was part of some copy/paste mistake.

Change-Id: Ib24d1f85cf90648b01fa81b285a1ec01fe28c545
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 16:07:48 +00:00
Lee Jones 66ded99622 dma: stm32f4x: Fix warning when !SYS_LOG_INF
The following warning occurs when !SYS_LOG_INF due to the fact
that these variables are only used for information purposes.
When logging is <INFO then the variables aren't utilised at all.
To fix this we're removing the variables completely and using
the direct calls from within the information prints instead.

drivers/dma/dma_stm32f4x.c: In function 'dma_stm32_dump_reg':
drivers/dma/dma_stm32f4x.c:196:11: warning: unused variable 'sfcr' [-Wunused-variable]
  uint32_t sfcr  = dma_stm32_read(ddata, DMA_STM32_SFCR(id));
           ^
drivers/dma/dma_stm32f4x.c:195:11: warning: unused variable 'sm1ar' [-Wunused-variable]
  uint32_t sm1ar = dma_stm32_read(ddata, DMA_STM32_SM1AR(id));
           ^
drivers/dma/dma_stm32f4x.c:194:11: warning: unused variable 'sm0ar' [-Wunused-variable]
  uint32_t sm0ar = dma_stm32_read(ddata, DMA_STM32_SM0AR(id));
           ^
drivers/dma/dma_stm32f4x.c:193:11: warning: unused variable 'spar' [-Wunused-variable]
  uint32_t spar  = dma_stm32_read(ddata, DMA_STM32_SPAR(id));
           ^
drivers/dma/dma_stm32f4x.c:192:11: warning: unused variable 'ndtr' [-Wunused-variable]
  uint32_t ndtr  = dma_stm32_read(ddata, DMA_STM32_SNDTR(id));
           ^
drivers/dma/dma_stm32f4x.c:191:11: warning: unused variable 'scr' [-Wunused-variable]
  uint32_t scr   = dma_stm32_read(ddata, DMA_STM32_SCR(id));

Change-Id: I91a0373ef6c9afa8a342181c0ab24bd58743300d
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-04-09 15:44:48 +00:00
Piotr Mienkowski 06685e75ae drivers: i2c: place all I2C Kconfig options in submenu
To follow Zephyr convention this patch is placing all I2C driver
Kconfig options in submenu.

Change-Id: Ibc485305b7effb65ed7f24b933fe35d0fa0afee8
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-08 00:12:30 +00:00
Piotr Mienkowski f33b277e6f drivers: i2c: rename I2C_CLOCK_SPEED Kconfig option
I2C_CLOCK_SPEED Kconfig option is DW driver specific. It does not
define I2C interface speed but rather the I2C DW module clock speed.
It is confusing for a user of any other I2C driver than DW.
This patch renames this option to I2C_DW_CLOCK_SPEED and makes it
visible only for DW I2C driver.

Change-Id: I97f57332fd5cca644eabdef0968a0b2174b885ff
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-08 00:12:29 +00:00
Piotr Mienkowski afdb0e0a70 drivers: eth_sam_gmac: Fix initialization order
Atmel SAM family GMAC Ethernet driver is implementing zero-copy
networking. As a result it has to reserve a defined amount of RX
data net buffers before bringing up the interface. Since net buffer
pool is initialized by the network stack and this driver was bringing
the interface up in its initialization function the driver initialization
was performed, as a workaround, after network stack initialization. It
is not a clean solution. This patch fixes this by bringing the
interface up in interface initialization function. The driver itself
can now be initialized before the network stack is.

Tested on Atmel SMART SAM E70 Xplained board

Change-Id: I65886fd6db6f27a10628e393cfabd8e5f78c08ff
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-07 12:35:51 +03:00
Piotr Mienkowski 816fdae44d drivers: eth_sam_gmac: remove possible null pointer dereference
Fix eth_tx function which was dereferencing a pointer before
checking that it is not null.

Tested on Atmel SMART SAM E70 Xplained board

Change-Id: Idae4cf9d9a80f6ee9f74a94dd1debe7511c5fab4
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-07 12:35:49 +03:00
Maureen Helm 53678df5e2 sensor: max30101: Add heart rate sensor driver
Adds basic sensor driver support for the Maxim MAX30101 heart rate
sensor.

This driver does not yet support any sensor triggers such as the data
ready trigger, or runtime changing of sensor attributes.

Default configuration values were taken from the MikroE Hexiwear driver.
https://github.com/MikroElektronika/HEXIWEAR

Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX30101.pdf

Jira: ZEP-720
Change-Id: Ie8981e124da36a56a214f133bf9a11b9f47d60fa
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-04-06 11:47:17 +00:00
Johan Hedberg d7a189d2ec drivers: display: mb_display: Unify image and string APIs
Both the string and image rendering may want to take advantage of
scrolling and sequential display capabilities. Consolidate the APIs so
that there's a single one for images (mb_display_image) and a single
one for strings (mb_display_print). Both take a duration parameter for
the per-frame duration as well as a mode parameter which specifies
sequential vs scrolling behavior as well as an optional looping flag.

Change-Id: Ia092d771e3f1b94afd494c7544dab988161c539e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-06 00:59:30 +00:00
Johan Hedberg 86e64b77f2 drivers: display: mb_display: Make display context more compact
Reorder the struct members for more compact layout. The current row
tracker tracks just values 0 to 2 so uint8_t is more than enough for
it.

Change-Id: I845c84aeb32d59ed0ebbd55d8b6cfda7ad19b75a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-06 00:59:29 +00:00
Johan Hedberg 5c22802fa2 drivers: display: mb_display: Get rid of unnecessary image tracking
We don't need to store copies of the current and next image when
scrolling text, since looking up the font is just as efficient and
also consumes less memory.

Change-Id: Ia905164c5b5784afb52cb2bb38c1ab1d00817df0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-06 00:59:28 +00:00
Johan Hedberg 0260af6372 drivers: display: mb_display: Add internal reset helper
Add a helper function to reset the state of the display, and make use
of it from the various public functions. This also ensures that the
timer is stopped before starting a new display routine.

Change-Id: I8a916b5b13c18b41b7fc3593e6d97e874ef117af
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-06 00:59:28 +00:00
Johan Hedberg e129699a50 drivers: display: mb_display: Add empty column to scrolling text
Add an empty column between characters of scrolling text so that the
individual characters are more easily distinguishable instead of being
back-to-back mashed together.

Also adjust the default scrolling step interval so that the character
display frequency stays roughly the same as before.

Change-Id: Idca0dc149a84f3f99b753a28ad1120ce75b97667
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-06 00:59:27 +00:00
Erwan Gouriou 13e4092ee0 pinmux: stm32l4x rework header definition
For a better clarity and minimize the possibility
of false definitions and duplicates, gather defines
by port and store the by alphabetical order then in
alternate function order.

Change-Id: Ib9febc9e6c5037a774190007120b87bf100c3fca
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-04 17:55:13 -05:00
Erwan Gouriou 3ca381cfb5 drivers: pinmux: clean stm32l4x pinmux headers
*Fix PB6/PB ALT_7 to USART1 instead of USART3
*Remove duplicate definition of PD5/PD ALT_7

Change-Id: I2e095fb77451d1bad62fb75aed304debf646fa3e
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-04 17:55:13 -05:00
Roger Lendenmann 5bcc8fa832 arm: spi: spi master support for nrf52 family
* SPIMx support for nrf52 spi interface with easy dma

Change-Id: I3221b14867924b91a9d809faf689090574f5dc1c
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
2017-04-04 17:55:13 -05:00
Erwan Gouriou 8e85600a30 drivers: i2c: stm32lx: Add support for I2C_2
Add support for I2C_2 instance on stm32lx driver

Change-Id: Iaa17305dd21f92954274ca522d30d464e0a53b7b
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-04 17:55:13 -05:00
Jon Medhurst e7391e3068 gpio: Add gpio_mmio32 driver to access basic 32-bit i/o registers
It is envisaged that this will be used by SoC or board code to make
available fixed purpose memory-mapped i/o registers to the rest of the
system which normally expects to use GPIO devices, e.g. for driving chip
select lines, LEDs or reading button states.

As such, the driver code doesn't provide a kconfig based configuration
mechanism, instead SoC/board code can hard-wire the devices it wants
with something simple like:

GPIO_MMIO32_INIT(misc_reg1, "MISC1", 0x12345678, 0xffffffffu)

Then, for example, if bit N of the register at 0x12345678 is wired up as
an SPI device chip select line, the SPI driver could be configured to
use pin N of the "MISC1" GPIO driver and not need any other board
specific code.

Change-Id: Ib02fcbab73fcf9637e25834db060fb3108626f47
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-04-04 17:55:13 -05:00
Erwan Gouriou 40286ec697 driver: i2c: stm32lx: align numbering scheme on data sheet
On stm32 family, IP instance numbering starts from 1.
Update i2c driver to this scheme to minimize user
confusion

Change-Id: I967d5975bbbad59cd8a3a7b6dfc665955d09cc9f
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-04 17:55:13 -05:00
Gil Pitney 9b12803bf7 cc3200: Resolve DTS fixup.
As part of the transition to Device Tree, a temporary
HAS_DTS configuration variable, and a .fixup file per board
with symbol aliases were added.

This patch removes the cc32xx related fixup file
definitions, except for those used additionally outside
the cc32xx drivers.

Since cc32xx has DTS files, and since HAS_DTS will always be true,
it also removes the 'if !HAS_DTS' blocks from the cc32xx Kconfig
files.

Change-Id: I1c1b9f734795f523342f82ab32f2a38983812c0b
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-04 17:55:12 -05:00
Gil Pitney ed1ba1e1a5 cc3200: Move pinmux and UART initialization to PRE_KERNEL_1
Previously, cc3200_launchxl board was not able to show the
Zephyr Boot Banner, as that required early initialization
of the UART driver, which was done POST_KERNEL.

This patch moves the pinmux and UART driver initialization
to PRE_KERNEL_1, allowing early printk, and the Boot Banner
to show.

Change-Id: I84a7c20c1d5bdc3de150dc6bb0adebc9a2d9f5cb
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-04-04 17:55:12 -05:00
Johan Hedberg 7e5df0cc02 drivers: display: Enhance BBC micro:bit string output capabilities
Add a new mb_display_print() API which takes printf-style parameters
and outputs scrolling text instead of one character at a time. The
existing mb_display_str() API is renamed to mb_display_string() for
consistency, and now also takes printf-style parameters.

Change-Id: I59c42bcd74c62f05ecb6d097dc808b9e5c1984c5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-04 13:54:00 +03:00
Johan Hedberg 380d24de1d drivers: Add support for BBC micro:bit LED display
Adds a simple driver to access the 5x5 LED display found on BBC
micro:bit boards. The display is so limited that no effort is done to
try to integrate with the existing console (which would likely make
the display unusable). Instead, dedicated mb_display_* APIs are added
that are specific to this display.

References:

 https://www.microbit.co.uk/device/screen
 https://lancaster-university.github.io/microbit-docs/ubit/display/

Jira: ZEP-1990
Change-Id: I431b5b358b5f07592a60d3aed87eaab6ac20ce25
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-04 08:14:36 +03:00
Jean-Paul Etienne bb164f26ea gpio: added support for the SiFive Freedom E310 GPIO driver
Change-Id: If299b6a5b0cd9e6c181d552d78989840d5a2fbe9
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:15:25 +00:00
Jean-Paul Etienne a916cf7e19 serial: added support for the SiFive Freedom E310 UART driver
Change-Id: I7552b316bd328c67eabb1dbf62342cb9b663845a
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:15:21 +00:00
Jean-Paul Etienne d7b713e5b8 interrupt_controller: added support for the SiFive Freedom E310 PLIC driver
The SiFive Freedom E310 Platform Level Interrupt Controller (PLIC) follows
the riscv PLIC specification as defined in the riscv privilege
architecture specification.

It provides implementation for the riscv PLIC APIs as
required by the riscv-privilege SOC Family for SOCs providing
support for the RISCV_HAS_PLIC config.

Change-Id: I95d02edb53deeccd91e490776e8e1dbfb82d235f
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:15:16 +00:00
Jean-Paul Etienne f2c96e8fff pinmux: added support for the SiFive Freedom E310 pinmux driver
Change-Id: I4d1a1775df20e8d074b2f5a4a9f91619289582ff
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:15:12 +00:00
Jean-Paul Etienne cd14317c41 timer: riscv_machine_timer: prevent spurious interrupt while rearming the timer
Rearming the riscv machine timer is done by first updating the
mtimecmp low value register. If the low value is updated with a
relatively small value, a timer interrupt can be generated while
updating the mtimecmp high value.

To avoid such a spurious interrupt to occur, disable the timer
interrupt while rearming the timer.

Change-Id: I50ab3f19554a9a8dfe70943b6da0d20be3de88dc
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:15:03 +00:00
Jean-Paul Etienne 1451f82aeb timer: riscv_machine_timer driver depends on SOC_FAMILY_RISCV_PRIVILEGE
Change-Id: I5cbb2845979f88eb005dfd7e0b1714b6fe6167d3
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:14:59 +00:00
Anas Nashif 7d5be2af73 Merge "Merge net branch into master" 2017-04-01 20:46:11 +00:00
Tomasz Bursztyka 3226b95a5f drivers/ieee802154: Adding support for CC2520 ccm crypto
This will provide the feature through Crypto API.

Change-Id: If6953a54b393544b019755ae73571effe0724e69
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:33 +02:00
Lee Jones 845ebe81f4 dma: stm32f4x: By default increment pointer through data passed through memory
Without this bit set, if we a pass ptr to a string such as:

  "This is a string\n"

The DMA'ed output would be:

  "TTTTTTTTTTTTTTTTTT"

Change-Id: I0186c95ddca0390596d22af2551dbfa6716a5082
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-31 08:47:03 +01:00
Lee Jones 08aa0c5bb3 dma: stm32f4x: Trivial: Prevent >80 char issue and neaten up
Change-Id: I63df16f415b22546136bf3e5b6eb4604a6066762
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-31 08:47:03 +01:00
Lee Jones 57d9a79b0b dma: stm32f4x: Prevent ddata from being directly referenced accidentally
The device data structure is statically declared and referenced
on a per-controller basis during driver registration.  Unfortunately,
due to using the same name (ddata) to initially declare as used
in individual functions, we accidentally referenced the main struct
by mistake due to a lack of local declaration.  Let's prevent that
from happening again by using different name-spaces.

Change-Id: I9f7e5e7f95ee68d71aee70fa979e015ca2b5519e
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-31 08:47:03 +01:00
Lee Jones 9e09a7d947 dma: stm32f4x: Pull in sub-channel information from Kconfig
The STM32 DMA controller supplies streams, which in turn provide a
selection of channels.  The stream number is provided by the DMA API
through it's 'channel' argument, but the sub-channel (within the
stream) is specified on an application case by case bases via Kconfig.

Change-Id: Ib5bfdb80f4d616516850787e1402164807771c5e
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-31 08:47:03 +01:00
Lee Jones a2e3a3ab7a dma: Kconfig: Provide a means to specify sub-channels
Some controllers contain channels with-in channels, or in the case
of the STM32 DMA controller channels within streams.  Channels
will vary depending on application, so these need to be provided
on a use-case bases.

Change-Id: I4f5fe3ec5817583b95dc7f059b5dc57f937523c4
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-31 08:47:03 +01:00
Maureen Helm de64c8394c fxos8700: Fix Kconfig help indentation
Fixes the fxos8700 Kconfig help indentation to be <tab><space><space>.

Change-Id: If6e9395b5d28044962ca568be5515658e7dc2627
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-30 21:21:22 +00:00
Maureen Helm f38ea1636a sensor: fxas21002: Add gyroscope driver
Adds sensor driver support for the NXP FXAS21002 3-axis gyroscope.
Includes statically configurable range and output data rate, as well as
the sensor data ready trigger.

Datasheet:
http://www.nxp.com/assets/documents/data/en/data-sheets/FXAS21002.pdf

Jira: ZEP-1392
Change-Id: I84587c4d5e76863245e9d045c6abb10b21b2615a
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-30 21:19:53 +00:00
Lee Jones 3d95a5d292 dma: stm32f4x: Remove unused 'id' attribute
Change-Id: I2e86649a14168cd96746d716809ccc37439d6e81
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 15:58:16 +01:00
Lee Jones 45fc0ac496 dma: stm32f4x: Use terminology found in the datasheet
Each controller contains a number of streams.  Subsequently each
stream contains a number of channels.  Channels are selectable
via the stream's control register.

Change-Id: Ib75d1377cb8fc38f27e4566b275343b2ffb8da65
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 15:58:16 +01:00
Lee Jones ec60772103 dma: stm32f4x: Add .stop() call
Change-Id: Ie335d9a70b8b1e17780471cc922e5265b4129140
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 15:58:16 +01:00
Lee Jones b44a176ec4 dma: stm32f4x: Add support for dev-to-mem and mem-to-dev transfers
Change-Id: Ie3877ac00de174dbd90918b53d9090da9f915eec
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 15:58:15 +01:00
Lee Jones c153e7eaa2 dma: stm32f4x: Add dump regs function to aid debugging
Change-Id: I271fc9671197cd646ccbed756e60f70d98e7a4ee
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 15:58:15 +01:00
Lee Jones 43bea395d3 dma: stm32f4x: Move to new DMA API
Commit c0bd8a0ce4 ("api: dma: dma api update") introduced some new APIs
and deprecated the old ones.  Let's move to the new API before the old
calls are completely removed.

Change-Id: I21795fa20124f8101c56b0fceb0f0d9afd96b0f0
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 15:58:15 +01:00
Lee Jones d5d269b7ef dma: stm32f4x: Adapt header file include to match new location
File include/misc/sys_log.h has been moved to include/logging/sys_log.h.

Change-Id: I011ca632396b574ae7e388b47fc2ba3a58fafc7b
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 15:58:15 +01:00
Lee Jones a33612057b dma: stm32f4x: Remove superfluous 'config' argument
Change-Id: I8f3156bff95625d643da3b30fa80d9870d301f2e
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 15:58:15 +01:00
Lee Jones 9aeb6f895d serial: stm32: Move to more traditional formatting
Providing a new line, then an attribute on the same line as the
following closing bracket is odd.  Move to something more
transitional and in line with regular coding standards.

Change-Id: I08f7cd76ca2f522a8b5b6de2e5baf94e95b5195a
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 12:59:48 +01:00
Lee Jones 49c2858d94 serial: stm32: Give H/W a chance to set the TXE bit on transfer
It is possible to evaluate the TXE bit *before* H/W has had the
opportunity to detect that data is being processed.  Therefore
we should hold off on any evaluation until TXE has initially been
set.

Change-Id: Iff26bfbe3ab419734003bf81a4cb357de83908e7
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-30 12:59:48 +01:00
Lee Jones 860f6abccd dma: stm32f4x: Obtain controller names from Kconfig
Change-Id: I730b3ad7c44f1bdb2f4dc5d4178a924aca59aa86
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-29 14:54:30 +00:00
Lee Jones 8c5b54e8b8 dma: stm32f4x: Obtain IRQ priority from Kconfig
Change-Id: I8f4cb8c8d95536e84fcb842d1f84d6c9256dfd88
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-29 14:54:30 +00:00
Lee Jones bb36c0af86 dma: Add possibility for up to 3 DMA Controllers
Currently only 1 is allowed.  While we're at it, let's generify the
existing entries, since they could be used by all controllers, not
just QMSI.

Change-Id: Iec5d195fff239931b21a7584eb4b642b40f95be5
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-29 14:54:29 +00:00
Lee Jones b15693d0e5 dma: Group devices together in Kconfig
Change-Id: Idbbd1d1fc73b1599ce8c3384776b949d16f87cb2
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-29 14:54:28 +00:00
Maureen Helm aa9c14667b ext: mcux: Update to mcux 2.2 for k64
Updates the mcux drivers and device header files for the k64 from mcux
2.1 to mcux 2.2. Updates the k6x soc init and ethernet shim driver to
reflect mcux interface changes.

Origin: NXP MCUXpresso SDK 2.2
URL: mcux.nxp.com
Maintained-by: External

Change-Id: Icb578dddbe84c190e990b756193bef621010a898
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-27 09:05:58 -05:00
Florian Vaussard a57df869b4 serial: stm32: Properly put Kconfig options in their own submenu
Currently the entries for STM32 UART ports are at the same level than
the top menuconfig UART_STM32. As a result they are mixed with other
configs in the "Serial Drivers" menu.

Use if/endif grammar to put these entries under a dedicated STM32
submenu.

Change-Id: If28945204b801578d29f8cce7c2370ca3c2737a1
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-03-27 09:05:57 -05:00
Florian Vaussard 87960944d2 gpio: stm32: Add support for ports I to K
Add support for GPIO banks I to K that can be found on some high-density
STM32F4 products.

Change-Id: I2cb65ed4d4a2282f7d17478cb1fcdd65dffe71b0
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-03-27 09:05:57 -05:00
Florian Vaussard 52d663d49d gpio: stm32: Use macro to simplify registration
The registration of each GPIO bank differs by only few details. These
differences can be factorized in order to create a generic registration
macro.

This has several advantages:
- Less code
- Easier to add new banks
- Less work to add support for new STM32 families

The diff stat speaks for it-self: 26 insertions(+), 92 deletions(-)

Change-Id: I674752fda5ee3caefb815ccf070a1b636b16cf85
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-03-27 09:05:57 -05:00
Florian Vaussard 33579adef9 clock: stm32f4: Fix range of CLOCK_STM32F4X_PLLN_MULTIPLIER config
The PLLN multiplier can range between 50 and 432 on all STM32F4, except
on the STM32F401 where the lower bound is restricted to 192.

Fix the range property and the help text to reflect this reality.

Change-Id: I7b93e84b321f7869aaf611287344cd3e25c893c8
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
2017-03-27 09:05:57 -05:00
Gustavo Denardin ad235dc24b arm: UART driver modifications for MKL25Z soc support
Since all interrupts come in on the status line,
we only connect it for the KL2X.

Change-Id: Ia9e0d483fe68464a0eeab08c95a043260e5793b0
Signed-off-by: Gustavo Denardin <gustavo.denardin@gmail.com>
2017-03-27 09:05:57 -05:00
Ricardo Salveti 51036ca5f4 nrf_rtc_timer: clear events and counter when disabling sys_clock
Clear pending IRQ when starting and restore back the RTC1 state when
disabling sys_clock, to avoid issues when soft rebooting the device or
chainloading another Zephyr image (e.g. mcuboot).

Change-Id: I693d9168196ad2cfb8475ecfa2051eac043b1fbd
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-03-27 09:05:57 -05:00
Kumar Gala 83d8ffb2a0 spi: mcux: Rename spi driver to DSPI to match naming convention
In prep for supporting the older KL2x SoCs that use a different SPI
block, rename the current SPI driver to DSPI to match what the MCUX HAL
defines it as.

Change-Id: I9097580df5fca649ab6fd9a38212fced0b1ea6ed
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-03-27 09:05:57 -05:00
Anas Nashif a53bc0eef0 sensors: sx9500: varables undeclared when in debug mode
Change-Id: I1625fffbe4c1d24b7976fe5b82dafc29e8ec8350
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-25 12:00:29 +00:00
Anas Nashif 2c04055970 Merge "Merge bluetooth branch into master" 2017-03-25 11:25:43 +00:00
Johan Hedberg 93fbca0d16 Merge bluetooth branch into master
- Controller cleanups
 - Refactor controller for a cleaner Link Layer abstraction
 - SDP enhancements
 - Use sys_slist_t API wherever possible
 - Fix race condition in controller
 - Update controller to report Bluetooth 5.0 version

----------------------------------------------------------------
Carles Cufi (6):
      Bluetooth: controller: Remove unused H:4 tag macros
      Bluetooth: controller: Rename downstream API calls
      Bluetooth: controller: Introduce BLUETOOTH_LL_SW
      Bluetooth: controller: Move ll.h to an include folder
      Bluetooth: controller: Remove public address config option
      Bluetooth: controller: Move LL code from driver to ll_sw

Johan Hedberg (11):
      Bluetooth: Make bt_hci_driver instances link-time constants
      Bluetooth: shell: Fix missing initialization of param.own_addr
      Bluetooth: shell: Add command to start continuous passive scanning
      Bluetooth: Move crypto APIs to dedicated header file
      Bluetooth: Controller: Factor out ECB core code from ecb_encrypt()
      Bluetooth: Controller: Introduce big-endian variant for ECB
      Bluetooth: Introduce public big-endian AES API
      Bluetooth: Controller: Increase default TX buffer count
      Bluetooth: Use specific pointer type for conn->channels
      Bluetooth: ATT: Reorder handler struct for compactness
      Bluetooth: ATT: Refactor PDU handling

Kaustav Dey Biswas (5):
      Bluetooth: SDP: Server: Send service search response
      Bluetooth: SDP: Server: Handle ServiceAttributeRequest
      Bluetooth: SDP: Server: Find the attributes in the record
      Bluetooth: SDP: Server: Send ServiceAttributeResponse
      Bluetooth: SDP: Server: Support ServiceSearchAttributeRequest

Luiz Augusto von Dentz (4):
      Bluetooth: ipsp: Fix checking for NULL pointer
      Bluetooth: L2CAP: Use sys_slist_t for connection channels
      Bluetooth: L2CAP: Use sys_slist_t for server channels
      Bluetooth: L2CAP: Use sys_slist_t for fixed channels

Mariusz Skamra (2):
      Bluetooth: L2CAP: Fix TX queueing for LE CoC
      Bluetooth: tester: Fix UART issue on qemu

Matthias Ringwald (1):
      Bluetooth: Controller: Kconfig company id and subversion number

Sathish Narasimman (5):
      Bluetooth: HFP HF: SCO: Handle synchronous_conn_complete
      Bluetooth: SCO: Rename 'conn' to 'acl'
      Bluetooth: HFP HF: SCO: Handle SCO Disconnect
      Bluetooth: HFP HF: SCO Initiate Audio connection
      Bluetooth: AT: Fix reset the state during error

Vinayak Chettimada (16):
      Bluetooth: Controller: Fix RSSI feature conditional compilation
      Bluetooth: Controller: Add advertisement event indication feature
      Bluetooth: Controller: Add Kconfig range check for public address
      Bluetooth: Controller: Version 5.0 and PDU type rename
      Bluetooth: controller: Use explicit paths to internal headers
      Bluetooth: controller: Move bt_rand into separate file
      Bluetooth: Make LE Encrypt helpers public
      Bluetooth: controller: Replace 0 for pointers with NULL keyword
      Bluetooth: Fix checks for changes in connection parameters
      Bluetooth: Support connection parameter update as central
      Bluetooth: shell: Reorder commands in logical order of use
      Bluetooth: shell: Add connection update command
      Bluetooth: controller: Move PDU macros from radio.h to pdu.h
      Bluetooth: controller: Cleanup makefiles
      Bluetooth: controller: Fix mayfly caller id for thread call path
      Bluetooth: controller: Fix race waiting for ticker job to complt

 drivers/bluetooth/hci/h4.c                         |   2 +-
 drivers/bluetooth/hci/h5.c                         |   2 +-
 drivers/bluetooth/hci/spi.c                        |   2 +-
 include/bluetooth/bluetooth.h                      |  15 +-
 include/bluetooth/conn.h                           |  11 +
 include/bluetooth/crypto.h                         |  77 ++
 include/bluetooth/hci.h                            |  24 +
 include/bluetooth/l2cap.h                          |   4 +-
 include/drivers/bluetooth/hci_driver.h             |   2 +-
 samples/bluetooth/ipsp/src/main.c                  |   6 +-
 subsys/bluetooth/Kconfig                           |   2 +-
 subsys/bluetooth/controller/Kconfig                |  39 +-
 subsys/bluetooth/controller/Makefile               |  23 +-
 subsys/bluetooth/controller/hal/Makefile           |   1 +
 subsys/bluetooth/controller/hal/ecb.h              |   3 +
 subsys/bluetooth/controller/hal/nrf5/Makefile      |   3 +
 subsys/bluetooth/controller/hal/nrf5/cntr.c        |   4 +-
 subsys/bluetooth/controller/hal/nrf5/ecb.c         |  64 +-
 subsys/bluetooth/controller/hal/nrf5/radio.c       |  17 +-
 subsys/bluetooth/controller/hal/nrf5/rand.c        |   4 +-
 subsys/bluetooth/controller/hal/radio.h            |   5 -
 subsys/bluetooth/controller/hci/Makefile           |   4 +
 subsys/bluetooth/controller/hci/hci.c              |  76 +-
 subsys/bluetooth/controller/hci/hci_driver.c       | 217 +-----
 subsys/bluetooth/controller/include/ll.h           |  58 ++
 subsys/bluetooth/controller/ll/ll.h                |  29 -
 subsys/bluetooth/controller/ll_sw/Makefile         |   4 +
 subsys/bluetooth/controller/ll_sw/crypto.c         |  54 ++
 subsys/bluetooth/controller/{ll => ll_sw}/ctrl.c   | 660 +++++++++--------
 subsys/bluetooth/controller/{ll => ll_sw}/ctrl.h   |  54 +-
 .../controller/{ll => ll_sw}/ctrl_internal.h       |   6 +-
 subsys/bluetooth/controller/{ll => ll_sw}/ll.c     | 237 ++++++-
 subsys/bluetooth/controller/{ll => ll_sw}/pdu.h    |  64 +-
 subsys/bluetooth/controller/ticker/Makefile        |   3 +
 subsys/bluetooth/controller/ticker/ticker.c        |  12 +-
 subsys/bluetooth/controller/util/Makefile          |   1 +
 subsys/bluetooth/controller/util/memq.c            |   5 +-
 subsys/bluetooth/host/Kconfig                      |  16 +-
 subsys/bluetooth/host/Makefile                     |   2 +
 subsys/bluetooth/host/at.c                         |   7 +-
 subsys/bluetooth/host/att.c                        | 204 ++++--
 subsys/bluetooth/host/conn.c                       | 148 +++-
 subsys/bluetooth/host/conn_internal.h              |  12 +-
 subsys/bluetooth/host/crypto.c                     | 155 ++++
 subsys/bluetooth/host/crypto.h                     |   8 +
 subsys/bluetooth/host/hci_core.c                   | 150 ++--
 subsys/bluetooth/host/hci_core.h                   |   2 +-
 subsys/bluetooth/host/hci_ecc.c                    |   9 +-
 subsys/bluetooth/host/hci_ecc.h                    |   5 +-
 subsys/bluetooth/host/hci_raw.c                    |   8 +-
 subsys/bluetooth/host/hci_raw_internal.h           |   2 +-
 subsys/bluetooth/host/l2cap.c                      | 202 ++----
 subsys/bluetooth/host/l2cap_br.c                   |  97 +--
 subsys/bluetooth/host/l2cap_internal.h             |   5 +-
 subsys/bluetooth/host/sdp.c                        | 781 +++++++++++++++++++++
 subsys/bluetooth/host/sdp_internal.h               |  14 +
 subsys/bluetooth/host/smp.c                        |  36 +-
 tests/bluetooth/init/prj_controller_4_0.conf       |   1 +
 tests/bluetooth/init/prj_controller_dbg.conf       |   1 +
 tests/bluetooth/shell/src/main.c                   | 137 +++-
 tests/bluetooth/test_bluetooth/src/bluetooth.c     |   2 +-
 tests/bluetooth/tester/qemu.conf                   |   1 +
 62 files changed, 2583 insertions(+), 1216 deletions(-)
 create mode 100644 include/bluetooth/crypto.h
 create mode 100644 subsys/bluetooth/controller/hal/Makefile
 create mode 100644 subsys/bluetooth/controller/hal/nrf5/Makefile
 create mode 100644 subsys/bluetooth/controller/hci/Makefile
 create mode 100644 subsys/bluetooth/controller/include/ll.h
 delete mode 100644 subsys/bluetooth/controller/ll/ll.h
 create mode 100644 subsys/bluetooth/controller/ll_sw/Makefile
 create mode 100644 subsys/bluetooth/controller/ll_sw/crypto.c
 rename subsys/bluetooth/controller/{ll => ll_sw}/ctrl.c (93%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/ctrl.h (84%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/ctrl_internal.h (98%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/ll.c (58%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/pdu.h (77%)
 create mode 100644 subsys/bluetooth/controller/ticker/Makefile
 create mode 100644 subsys/bluetooth/controller/util/Makefile
 create mode 100644 subsys/bluetooth/host/crypto.c
 create mode 100644 subsys/bluetooth/host/crypto.h

Change-Id: Ic8bee0eb4f15c00ce5ca7b3b80133b1bbd0bdbf5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-24 23:21:09 -07:00
Andrei Emeltchenko 0d168bff77 drivers: cc2520: Correct configuration options
At the moment CC2520 configuration options are selected inside "TI
CC2520 Driver RAW channe" submenu like:

           [*] TI CC2520 Driver support  ----

           [ ] TI CC2520 Driver RAW channel  --->

Make RAW channel depends on TI CC2520.

Change-Id: I92879b7f4391f1842c012b6c03c78956e90b9441
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-03-24 17:31:40 +02:00
Maureen Helm 4905e400ed fxos8700: Add support for temperature
The fxos8700 is primarily an accelerometer/magnetometer, but it does
also include a temperature sensor. Note that the temperature sensor is
uncalibrated and can only be used when the magnetometer is enabled
(magnetometer-only mode or hybrid mode).

Change-Id: I74c4ae68c30e0f9836caa70baed44ad8956b17ea
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-23 09:41:48 -05:00
Maureen Helm 1a344ed8fc fxos8700: Use SYS_LOG_ERR instead of SYS_LOG_DBG for errors
Converts fxos8700 error messages from SYS_LOG_DBG to SYS_LOG_ERR.

Change-Id: Ic2b3245fd46372d585df81deeafb56e31cdf542a
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-23 09:34:08 -05:00
Dario Pennisi 8e27ad430e Added sensor driver for ADXL362
The ADXL362 is a 3-axis MEMS accelerometer.

See
http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL362.pdf

Jira: ZEP-1695
Change-Id: I29d870b59e62412452494cf0bc06eac632bebba5
Signed-off-by: Dario Pennisi <dario@iptronix.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-22 08:36:07 -04:00
Anas Nashif 4679a5f413 sensor: bme280: fixed SPI device init
Change-Id: I92bc6cbe9cc9458e0aaedf42c3821bcea91e15be
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-22 07:49:00 -04:00
Johan Hedberg 5517893543 Bluetooth: Make bt_hci_driver instances link-time constants
Declaring these as const lets the linker generate more optimal code.
Some extra care is needed with hci_ecc.c since it was overwriting the
send callback. Now the choice of send() call is done directly in the
bt_send() function

Change-Id: Iac74f5ee9bee097bbb34c11bd13d1d886700f5cc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Anas Nashif 3dc9af66ca sensors: BME280: added support for SPI communication
Support connection via SPI and keep I2C as the default.

Jira: ZEP-1698
Change-Id: I42a76131577a37429375364deb07e451107f5d81
Signed-off-by: Dario Pennisi <dario@iptronix.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-21 10:39:27 +01:00
Jukka Rissanen 2b487646d6 drivers: ieee802154: cc2520: User can set the MAC address
Allow user to set the four last bytes of a MAC address.
By default the bytes are selected randomly but for testing
purposes we need a way to specify the address in advance.

Change-Id: Ic9820a8026b327d1ee5025ab77fdc77f5778de67
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:45 +02:00
Piotr Mienkowski c54b3c7e8f drivers: Update Atmel SAM family GMAC Ethernet driver
Networking stack has split one global DATA pool to RX and TX DATA pools
and also added net_buf pool support to each context. Update the driver
to support this new design. Since the GMAC TX descriptor list has a fixed
size but the number of TX DATA buffers is no longer limited updating the
TX descriptor list has to be guarded by a semaphore.

Tested on Atmel SMART SAM E70 Xplained board

Change-Id: I181e1cdd183e173b85d5d1711b6e78cd5165666d
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-03-17 10:34:44 +02:00
Jukka Rissanen f7a5612ba2 drivers: slip: Fix memory corruption when receiving packet
It is possible that the slip->last pointer is not set during
the startup of the slip driver if we receive some garbage bytes.
This in turn caused memory to be overwritten in random places.

Jira: ZEP-1737

Change-Id: Ia2ce193b81a8f707b7ca63497d497ea70699bb32
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:44 +02:00
Jukka Rissanen 207128a869 drivers: slip: Use always the initialized network interface
No need to always look through all the network interfaces
when receiving packet as we support only one interface and
it is always the same one.

Change-Id: Ic0bfabc8409160352081cac1a6c3dbbfa35fe390
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Inaky Perez-Gonzalez e1a6c7d472 drivers: slip: Allow specifying the MAC address from config file
The current state of affairs will not allow to set a MAC address and
thus will initialize a random MAC address.

However, when we are in a situation where we are trying to interface
Zephyr OS QEMU VMs with physical targets for testing, this is not
practical. We need to create a macvtap interface, on which we need to
set the MAC address of the Zephyr OS SLIP device so packets can be
routed.  There is no way to guess which random address is going to be
used, and there is no practical way to query it.

So this patch adds a CONFIG_SLIP_MAC_ADDR config
setting. slip_iface_init() is changed to take the code from
slip_get_mac() for initializing the MAC address (which should be
happening there anyway) and if CONFIG_SLIP_MAC_ADDR is set, it takes
that one -- otherwise goes to generate a random one.

Change-Id: I55a68f2743604f310d41c934783eca82084d7e94
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-03-17 10:34:43 +02:00
Paul Sokolovsky f1a919187e drivers: eth_enc28j60: Clarify comments in the header file.
Change-Id: Idfac3e6718a2be135e0b4c7f32aad0ddccf18e3c
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-03-13 18:02:34 +03:00
Sergio Rodriguez 381df63fe8 drivers: dma_qmsi: Wait few cycles to allow DMA controller changes
Add few nop instructions to allow the DMA controller settle,
It takes time after starting the transfer to access the DMA
controller registers, so a few cycles are added, the minimal number
of cycles needed has been calculated using tests results on c1000
development board.

Jira: ZEP-1803

Change-Id: I1f8e8478f0350e1b6e4dd596b783dc4babc2d02b
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-03-10 22:40:06 +00:00
Tomasz Bursztyka bd7cd8c056 drivers/net/ieee802154: Display the wrong channel setting in error msg
Change-Id: I42987715594f35aa0bc77a17970c430b5605f199
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-09 20:33:50 +02:00
Wojciech Bober 4199713d44 drivers/ieee802154: Added RAW device to nRF5 radio driver
This commit adds missing RAW mode device to the driver.

Change-Id: I9ee9c41bc94b0ae202613ef707030033b46df1de
Signed-off-by: Wojciech Bober <wojciech.bober@nordicsemi.no>
2017-03-09 20:33:47 +02:00
Marcus Shawcroft d261385ed4 eth/mcux: Turn down the PHY debug verbosity.
The PHY debug code is useful while working specifically with the PHY
state machine, but in general the frequent, periodic nature of the
output is a hinderance.  Turn down the verbosity, leave a local define
available for anyone who specifically needs to see the PHY state
machine debug.

Change-Id: I40e59b6df5c29702813d3a554ea9e795a3761c65
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-03-09 20:33:47 +02:00
Marcus Shawcroft 43a19bd322 eth/mcux: Fix Kconfig help formatting.
Change-Id: I3d3ff448ca866a2c970d87b4c9f25fc40549c36b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-03-09 20:33:47 +02:00
Wojciech Bober 162f25bc30 drivers/ieee802154: Added RAW mode support to nRF5 radio driver
Change-Id: Ib327032458d5098f0ee4f01ae719f23a856901c1
Signed-off-by: Wojciech Bober <wojciech.bober@nordicsemi.no>
2017-03-09 20:33:47 +02:00
Juan Manuel Cruz 26b014800b drivers: enc28j60: buffer reception waits timeout
The enc28j60's reception routine requires a timeout
for a buffer assignation. The timeout is configurable
to allow a per application fine tuning.

The effect that K_NO_WAIT currently has is that there are frames
lost everytime that a buffer is required and there are none
available.

Jira: ZEP-1169

Change-Id: Ia18736fd85daee51fe1c2304977209cc7f0038b5
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2017-03-09 20:33:46 +02:00
Jukka Rissanen 5197266768 net: nbuf: Use net_nbuf_get_frag() to allocate a fragment
The code used net_nbuf_get_reserve_{rx|tx}_data() function to
allocate a fragment. Instead of that low level function, use
net_nbuf_get_frag() instead. There are few places this is not
possible or is too big change like in few test programs.

Change-Id: Ied7e2b7db352de998b200ffa6ff82471bfa5ebe3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Jukka Rissanen d32503f57e net: nbuf: Split one global DATA pool to RX and TX DATA pools
If we receive lot of packets, it might happen that we exhaust
all the DATA buffers in the system. This would prevent from
us sending anything to the network.
Change this by splitting the DATA buffer pool into RX and TX
parts. This way RX flooding cannot consume all DATA buffers
that needs to be sent.

Change-Id: I8e8934c6d5fdd47b579ffa6268721b5eb3d64b6d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Marcus Shawcroft e82818c59b eth/eth_mcux: Make promiscous mode configurable.
Provide a configuration option for promiscuous mode.

Promiscuous mode provides a convenient workaround for ZEP-1673 however
it generates significant demand for RX buffers on a loaded network.
Add a configuration option to conveniently enable / disable.

The Kconfig defaults promiscuous on to workaroudn 1673, once that
issue is resolved the default logic on NET_IPV6 will be dropped.

Change-Id: I6929aca70d7bd88ce88c65d6654d664ea6653b66
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-03-09 20:33:42 +02:00
Souvik K Chakravarty 8fa2f82524 watchdog: Add WDT driver for Atmel SAM SoCs
Basic Watchdog driver for Atmel SAM family MCUs. Currently only
disabling the watchdog is supported.

Tested on Atmel SAMV71 Xplained Ultra Evaluation Kit.

Origin: Original

Jira: ZEP-1684

Change-Id: I8f717c7f53aa290c944b7935e0570c2a6f53956e
Signed-off-by: Souvik K Chakravarty <souvik.k.chakravarty@intel.com>
2017-03-09 13:43:17 +00:00
Andrew Boie 3cc4d41438 ipm_console: add Kconfig for receiver stack size
Change-Id: I27c1189e3bf87b4ea3dc06d38f63cab21663697b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-03-06 16:58:20 +00:00
Bogdan Davidoaia 5473906993 random: add MCUX TRNG driver
Provide a random driver wrapped around the MCUX TRNG driver.

Change-Id: Icbd7ab587aa18ecbd7eae52290aaa5d8ee504cf2
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-03-02 14:13:27 +00:00
Bogdan Davidoaia 50cb5a6bd3 random: mcux: rename random_mcux to random_mcux_rnga
MCUX contains more than one type of random number generator,
so refrect this in config and file names.

Change-Id: Iba4482a1ae41f35d471686f8b159c113147c4df8
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-03-02 14:13:25 +00:00
Anas Nashif cd35c575ef Revert "sys_bitfield*(): use 'void *' instead of memaddr_t"
This reverts commit 1f2ee5c6bc.

Change-Id: I6d6662952450e54aea2ffbc43973a5ecc40767bb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-28 16:06:22 -05:00
Inaky Perez-Gonzalez 1f2ee5c6bc sys_bitfield*(): use 'void *' instead of memaddr_t
Current users of sys_bitfield*() are bending over backwards to cast
what is most of the times a pointer into an integer.

Bitfields can be better described with an void *, so
uint{8,16,32,64}_t or any other container can be used. Most
sys_bitfield*() operations, by extension, can do the same. Note void *
has byte arithmetic, like char *.

This change will also make it implicit, for any future split of the
address space between virtual (what the SW is seeing) and physical
(what the HW is seeing) way clearer, as the functions dealing with
physical, non directly referentiable/mappeable addreses to use an
integer type, like mem_addr_t.

- include/arch/ARCH/*asm_inline*:

  - sys_bitfield*() all modified to take 'void *'

    Note 'void *' arihtmethic is byte based, which makes some things
    easier.

- include/sys_io.h:

  - introduces DEFINE_BITFIELD
  - update docs

- tests/kernel/bitfield: remove all the cast contortions, use DEFINE_BITFIELD
  PENDING: update other TCs

- include/arch/nios/nios2.h, drivers/interrupt_controller/ioapic_intr.c:
  remove cast contortions

Change-Id: I901e62c76af46f26ff0d29cdc37099597f884511
Jira: ZEP-1347
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-02-28 14:37:54 +00:00
Paul Sokolovsky 203dec3b69 gpio: mcux: Revert to older GPIO device names as were used for Kinetis.
These are more consistent with naming used by other ports (uppercase,
short), and some existing software relies on them to be exactly those.
This change is a follow up to the discussion on the Zephyr mailing
list, calling to establish consistent naming conventions for Zephyr
devices, and is a small step in that direction.

Change-Id: I013b0505b579c6337aeb6fbef2423216ca6cf046
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-02-28 11:18:32 +00:00
Anas Nashif c78a3485e2 Merge "Merge net branch into master" 2017-02-27 22:32:01 +00:00
Vinayak Chettimada 853fd133c1 drivers: serial: nrf5: Fix system off pin configuration
To secure correct signal levels on the pins by the UART when
the system is in OFF mode, the pins must be configured in
the GPIO peripheral as described in nRF5 Product
Specification.

UART Pin, Direction, Output Value:
RXD, Input, NA
CTS, Input, NA
RTS, Output, 1
TX, Output, 1

This commit sets the RTS line to a initial value of 1.

Change-id: I5147fe58033f42c979b9354798b6fd13d78f7f71
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-02-27 21:02:20 +00:00
Carles Cufi 6a23e82186 drivers: gpio: Set the line to the pull by default
To avoid glitches in the lines, set the line to the pull specified
before actually changing the line's direction (in/out) so that no
unexpected pulses are generated.

Change-id: I4fe133c5b82f2a1bfa473341612c2c7eca9027b8
Signed-off-by: Krzysztof Chruściński <Krzysztof.Chruscinski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-02-27 21:02:19 +00:00
Marcus Shawcroft e675352e10 eth/eth_mcux: Provide start and stop operations on the PHY driver.
Refactor the PHY state machine and add support for explicit start and
stop.

The stop implementation remains partial, the state machine will enter
a disabled state but will not actual attempt to power down the PHY.
This is deliberate, while implementing this it has become apparent
that issuing a PHY power down command is an effective way of bricking
frdm-k64f boards, hence explicit power down deliberately disabled
until the issue is properly understood.

Change-Id: I846a51b0ac48feed35d260cf20b50f4f1ac59298
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-27 10:28:55 +02:00
Marcus Shawcroft d9dfd503df eth/eth_mcux: Provide phy state name printing in debug
Change-Id: I07cb7d9958b00b94ed7e7801d6b8c0eb421ce4bf
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-27 10:28:55 +02:00
Wojciech Bober 0f878f6c33 drivers/ieee802154: Add missing parameter to net_if_set_link_addr()
Add the link type to net_if_set_link_addr() call. This fixes the
driver after changes introduced in
4eb2020055.

Change-Id: I72475a055ac805524b4b0f0c2380513e8f041368
Signed-off-by: Wojciech Bober <wojciech.bober@nordicsemi.no>
2017-02-27 10:28:53 +02:00
Erwan Gouriou de684bbdaa clock_control: fix to get PLL2 source for PREDV1 working
Some fixes where needed to get PLL2 source of PREVI1 functional.
Compiled ok with following configuration:
CONFIG_CLOCK_STM32F10X_CONN_LINE_PREDIV1_SRC_PLL2CLK=y
CONFIG_CLOCK_STM32F10X_CONN_LINE_PREDIV2=0
CONFIG_CLOCK_STM32F10X_CONN_LINE_PLL2_MULTIPLIER=8

Jira: ZEP-1758

Change-Id: I5ddfaef1b44c4c4e5e6adedc158a1c9092bc8df5
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-22 18:09:22 -06:00
Erwan Gouriou 0aea704462 gpio: enable ports F G (and H) for stm32f1xx (stm32f4xx)
Some GPIO ports activation where missing since not used
on available soc/boards.
Since stm32 family increases, activation of these ports
should be made available.

Jira: ZEP-1551

Change-Id: I612d135b28ef255bc771599e33796671ff81d0ac
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-22 18:09:11 -06:00
Jorge Ramirez-Ortiz 29a8e0292e flash/stm32: driver for STM32F4x series
Change-Id: I0f90bcda7a694de81c594a6616da0faf40306702
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2017-02-22 18:08:57 -06:00
Andrew Boie b8d57738b8 cortex_m_systick: fix _timer_cycle_get_32() race
We need to account for the interrupt happening in the middle
of the calculation.

Issue: ZEP-1546
Change-Id: I193534856d7521cac7ca354d3e5b65e93b984bb1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-22 18:45:36 +00:00
Jukka Rissanen c85127db80 drivers/ieee802154/pipe: Use net_nbuf_unref to release net_buf
Using net_nbuf_unref to release the net_buf so that we can
debug the allocations more easily. It is ok to use the original
net_buf_unref() too, we just miss some important net_buf
housekeeping information if done like that.

Change-Id: Ieb7b39ed525bfc46eb5c07a01f2a3a75fdbeb9fd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-22 17:28:26 +02:00
Ravi kumar Veeramally 84ce2a6d8f drivers: slip: Skip buffer allocation for incomplete packet
If slip_input_byte fails to get buffer for the first byte then no point
of saving later bytes and send it to upper layers. Final packet will be
incomplete and upper layers will discard it. Consider incoming bytes
only after successful buffer allocation on first byte, otherwise silently
ignore it.

Change-Id: Ie16d0df0c608d1644d39f66900252a340051c012
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-22 17:28:25 +02:00
Ravi kumar Veeramally eb31179cf3 drivers: slip: Add more comments for slip write scenario
No functionality changes. Added more comments and used switch cases
for more readability.

Change-Id: I9396270d7368d9b0c923a88f90b44129a1d69cbc
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-22 17:28:25 +02:00
Ravi kumar Veeramally 59b310e962 drivers: slip: Remove unused variables
Change-Id: Ib3aae91a1f40066f8902e9b2e709b13d1b57a2cb
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-22 17:28:25 +02:00
Jukka Rissanen 4eb2020055 net: Set the network link address type when setting link address
The interface L2 address type is set at the same time as the
L2 address is set to the network interface. This is most
convinient place to set the address type.

Change-Id: I712d7357d075959eb79df3463141cfbc6d163a74
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-22 17:28:25 +02:00
Wojciech Bober f810a202c8 drivers/net/ieee802154: nRF5 802.15.4 radio driver
This commit adds a driver for nRF5 802.15.4 radio. This driver
is a wrapper for the driver provided by ext/hal/nordic/drivers.

Change-Id: I20ee4aff3d1b994c621ba8eaab208d15d85e4c01
Signed-off-by: Wojciech Bober <wojciech.bober@nordicsemi.no>
2017-02-22 17:28:24 +02:00
Johann Fischer 0c65215ab5 drivers: mcr20a: cleanup and refactor interrupt processing
The interrupt processing of MCR20A was flawed and complicated.
This patch simplifies the handling of interrupts and reduces
the number of necessary SPI transfers.

Minor fixes:
 - use mutex for the PHY access control
 - remove unnecessary mcr20a_mask_irqb calls
 - do not read RX_FRM_LEN twice
 - increase timeout for sequence synchronization semaphore
   if the log level greater than 1
 - enable only the Sequence-end (SEQIRQ) interrupt
 - fix magic in NET_DEVICE_INIT
 - make the timeout values dependent on the log level

Change-Id: Ib3f64a092ffba91c80ff6e1d5cec995ab9d40bfb
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-02-22 17:28:24 +02:00
Øyvind Hovdsveen d787099c90 drivers/timer: Fixing issue in nRF RTC driver when RTC handler is blocked.
Fixes an unlikely issue that could arise if the RTC handler in the nRF RTC
driver was blocked for more than one sys tick interval. This could lead to
_sys_clock_tick_announce() being called with more than one sys tick when the
kernel did not expect it.

Jira: ZEP-1763

Change-ID: I5608fca6f0ac97a17c1ce452c1c5c67696a49a9a
Signed-off-by: Øyvind Hovdsveen <oyvind.hovdsveen@nordicsemi.no>
2017-02-22 13:58:53 +00:00
Andrew Boie 68c9d9779c x86: loapic_timer: use TSC for k_cycle_get_32()
The LOAPIC driver was doing this in a way susceptible to a very
nasty race condition: the CCR register could reset and be readable
before the associated interrupt could be delivered.

This resulted in a small window of time where CCR was reset, but
accumulated_cycle_count not updated, causing some calls to
k_cycle_get_32() to appear to jump backwards in time.

Just use the x86 TSC for these cycle timestamps. A divisor may be
provided in cases where the CPU clock speed is some multiple of
the bus speed. Modern x86 CPUs do not change their TSC rate even
when adjusting cpu frequency, so this should be a reliable timing
source.

Issue: ZEP-1546
Change-Id: I441bd8e32af866587a91f306e89e3fa0ece512b5
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-21 22:30:47 +00:00
Andrew Boie 15b8ed1a6a arcv2_timer: fix cycle count race
It's possible the timer interrupt could occur when performing the
computation, resulting in incorrect values returned.

It's still possible for bad values to be returned if the function is
called with interrupts locked, but that is only fixable with a second
timer source.

Issue: ZEP-1546
Change-Id: I16d5b04c3e32377f7249eb4fb1bf2f7c22bd0836
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-21 01:44:01 +00:00
Anas Nashif fe118c4e95 license: replace APL2.0 license with SPDX
Some files made it through review process with full license header.

Change-Id: I2722b127c40b4b19500042c12e4fde85a165bae9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-20 16:59:46 +00:00
Wojciech Bober 923560a959 drivers/timer: Rework the nRF RTC driver.
This is a reworked version of the previous RTC driver. The main
changed is related to the handling _timer_idle_exit() on non-RTC
wake-ups. The previous version didn't announce the elapsed time
to the kernel in _timer_idle_exit(). Additionally, the driver now
makes sure never to announce more idle ticks than the kernel asked
for, since the kernel does not handle negative deltas in its timeout
queues.

Change-Id: I312a357a7ce8f0c22adf5153731064b92870e47e
Signed-off-by: Wojciech Bober <wojciech.bober@nordicsemi.no>
Signed-off-by: Øyvind Hovdsveen <oyvind.hovdsveen@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-02-17 20:27:10 +00:00
Andrew Boie e08d07c97d kernel: add flexibility to k_cycle_get_32() definition
Some arches may want to define this as an inline function, or
define in core arch code instead of timer driver code.
Unfortunately, this means we need to remove from the footprint
tests, but this is not typically a large function.

Issue: ZEP-1546
Change-Id: Ic0d7a33507da855995838f4703d872cd613a2ca2
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-16 19:27:59 +00:00
Andrew Boie 09648cf8ec altera_avalon_timer: disable high-resolution timestamps
On Nios II the same timer peripheral IP block can't function
as a periodic system timer and a high-resolution timestamp source.
A second timer instance with different configuration is required.
Until that is implemented, just return the accumulated cycle count.

Issue: ZEP-1546
Change-Id: If3dcebdc60334bf3aa0ab45ccd82f1b2531b6bc1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-16 19:10:19 +00:00
Andrew Boie 97d76cad66 riscv_machine_timer: fix k_cycle_get_32()
There are race conditions trying to coordinate the value between
the accumulated_cycle_count (updated at interrupt time) and
trying to compute the delta from the last interrupt using the
mtime registers. An unlucky call could result in the timestamp
appearing to move backwards in time.

the 'mtime' register isn't reset at every interrupt. Since we just
want a cycle counter, report its raw value.

Issue: ZEP-1546
Change-Id: I9f404b33214d6502fea47374fcf0ecbf84ef8136
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-16 19:08:04 +00:00
Lee Jones fe8d1bdedb dma: Introduce STM32F4x DMA driver
This driver currently only handles memory-to-memory transfers.

TODO: Add support for all types of transfers.

Change-Id: Ic9787dcca919a58fb11b48c9f6b6b371db88c3ea
Origin: Original
Maintained-by: Zephyr
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-02-16 11:17:28 +00:00
Anas Nashif 15a6598691 Merge "Merge remote-tracking branch 'origin/core'" 2017-02-15 04:33:25 +00:00
Anas Nashif 643f3603f1 crypto: include tinycrypt only when enabled
Change-Id: Iea978586a529539255351fb05c7c76ca30baf8ce
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-15 02:07:16 +00:00
Anas Nashif 278f05770b ipm: fix Makefile to include drivers correctly
Change-Id: I606e7b4c5aebc5429e5e8288a5ed916569c7fa0a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-15 02:07:15 +00:00
Juan Manuel Cruz Alcaraz 485da78449 ataes132a: Adds a driver to support ATAES132A device
Adds a driver for Atmel Crypto Authorization solution
ATAES132A crypto device.

The driver supports the following functionality.

- AES CCM encryption, decryption and authentication
- AES ECB block operation.

The driver requires an I2C device to access crypto device registers.

Jira: ZEP-1387

Change-Id: I60aa8f3b069b703d4f83d866d28391625bb9ac13
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2017-02-15 02:07:14 +00:00
Jithu Joseph de106b026a drivers/crypto: TinyCrypt shim driver
Shim layer interfacing between crypto APIs and TinyCrypt
library. Currently facilitates only a subset of TinyCrypt
features/algorithms.

Jira: ZEP-509

Change-Id: I7fe6b9d86df016d92d717378d08a1ab09caafb31
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-15 01:08:15 +00:00
Iván Briano 867e61cbf3 drivers gpio: Fix disabling of interrupts for QMSI shims
When a GPIO pin is configured, the shim driver will first read the
current values in the controller registers to keep the other pins from
changing their configuration. After that it sets the bits for the
corresponding pin accordingly.

When the flag to enable interrupts is passed to the function, the
corresponding bits are all set properly, but no changes are made if
interrupts are not requested. This makes it impossible to disable
interrupts for a given pin once they've been enabled.

Fix it by always resetting the interrupt enabled bit when they have not
been requested. Other values can be left untouched as they won't have
any effect.

Jira: ZEP-1717

Change-Id: I30e97bb06d966291e23d0c66ddf39bce615c287b
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2017-02-15 00:25:32 +00:00
Jorge Ramirez-Ortiz 28e60ef7ed flash/nrf5: fix invalid write access
Requesting a flash_write with a length of 0 results in a flash
position being written. Instead we should return 0 unless there is
some other input parameter that is invalid.

Change-Id: Ife6e6e2314bbee2bde7d0b69db3122ca00c361e0
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2017-02-15 00:08:33 +00:00
Paul Sokolovsky 5035f97686 eth/mcux: Add temporary workaround to unbreak IPv6 ND features.
This is a workaround for lack of driver API support for multicast
management. So, instead we want to receive all multicast frames
"by default", or otherwise basic IPv6 features, like address
resolution, don't work. On Kinetis Ethernet controller, that
translates to enabling promiscuous mode. The real fix depends
on ZEP-1673.

Change-Id: I98a27584be65bdc405de005383eb30bad2a7fcfc
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-02-14 08:30:35 +02:00
Marcus Shawcroft bbada2de50 eth/mcux: Add basic PHY support.
Add basic PHY management sufficient to detect link up, link down and
auto negotiated link speed / duplex.  The PHY driver is implemented as
a state machine that executed in the system work queue.  The
implementation is non blocking, using the MII interrupt to capture the
completion of read and write events.

This PHY management should be fairly generic. In the future, it may be
beneficial to pull this code out as a standalone PHY driver for use
with other ethernet drivers.

JIRA: ZEP-1674

Change-Id: I3dcb5c14982ef4b40591fcf10d84840b8a2558e5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-14 08:30:34 +02:00
Andrew Boie 42562b9367 xtensa: fix numerous checkpatch issues
Change-Id: I903f5f0692849fb9e7bf5d978b63b12bf1bd6e33
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:03 -08:00
Mazen NEIFER 4bff13e20a Xtensa port: Fixed Xtensa timer in case of tickles idle.
This driver was written for v1.5 before the introduction of the function
_sys_clock_final_tick_announce. At that time _sys_idle_elapsed_ticks was reset
to 0 automatically. Now that it is reset by the new function, the driver needed
to be fixed.

Change-Id: I039b4dbacb691aaf992b37e44404abd19a54a833
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:02 -08:00
Mazen NEIFER ff0828faf3 Xtensa port: Fixed compilation errors caused by last rebase on master.
Change-Id: If2896bcce26652ded2059a11620370e34f98d1e4
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:02 -08:00
Andrew Boie eab8a9f9ca xtensa_sim_console: remove deprecation warning
Change-Id: I10181f6c4d90e38927c1831c93fc459d33de6fd1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER 8f92bc255c Xtensa port: Added support for Xtensa internal timer as system timer.
Change-Id: I1a0be1a377999f18ae47687edf4fc4950dcc5ba5
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER b0669a04b3 Xtensa port: Added support for Xtensa simulator console driver.
Change-Id: I58effa98fd6ff53bcfd21cb8de2fcd89651dc1d9
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER 0c736f2916 Xtensa port: Added Xtensa internal timer configuration need by assembly files.
This is needed by next commit as some assembly files handling interrupts use
some options from this file.
This file is not included in next commit to separate code and build system
aptches.

Change-Id: Iff3a8019362599beb0c0058c3169480fa5183c1c
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Anas Nashif 110df98619 Merge "Merge arm branch into master" 2017-02-11 04:00:58 +00:00
Jithu Joseph d625c2bb4c grove: fix variable type mismatch
These were reported by ISSM compiler.

Jira: ZEP-1179

Change-Id: I10d04c2949ad2a390d4c1159d2342c73108a58b7
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-11 00:14:15 +00:00
Erwan Gouriou 8ab42c92ce clock_control: stm32: code optimization
This commit brings code size optimization as suggested by Christer
Weinigel review during review of initial commit for this driver.
It also cleans up useless definition in header file.

Change-Id: Ibeaa2e51570dff21825c60c30ba83d939b31d938
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 726d4dc437 drivers: stm32: clean up after stm23cube based clock control
After activation of cube based driver support on L4 and F3 series,
this commits performs the clean up of F3 and L4 relative code to
native clock control drivers.
Indirectly, it makes pwm driver supported de facto on F3 series

Change-Id: Idac17103a9b5ef6eab540719343cc8f5865f15fa
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 3c389b54f0 clock control: clean up after stm32cube LL driver
After introduction and activation of STM32Cube LL based driver on
F3 and L4 series, this commit removes the no more needed code for
native driver for these soc.

Change-Id: I266d1a3fc4b464cee34b1cc1a1a333c5bf923e41
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 221087a72e flash: update stm32 flash_f3x to support LL clock control driver
After introducing STM32Cube based clock control driver for
stm32 family, update stm32f3xx flash driver to support it.
Clean up will be done afterwards.

Change-Id: I3260bb063f714fa29adbc71d8036f20479a99b34
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 2ab8250c5b pwm: update stm32 pwm to support LL clock control driver
After introducing STM32Cube based clock control driver for
stm32 family, update stm32 pwm driver to support it.
Once supported across the whole family, a clean up will be done.

Change-Id: I2ed38763b706e34ea1dceea50e97ce836dd9e195
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou bb2db5dbc5 i2c: update stm32 i2c_lx to support LL clock control driver
After introducing STM32Cube based clock control driver for
stm32 family, update stm32 i2c_lx driver to support it.
Clean up will be done in a following commit.

Change-Id: Ie5059bf4122d65fab1a663a5b00e0d761850a49d
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 0a902c345c i2c: stm32: change deprecated constant
Use of SECONDARY in DEVICE_AND_API_INIT is now deprecated and should
be replaced by POST_KERNEL

Change-Id: I543ae70e493527e75b4a4bcb9191475065b49166
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 8c4f2a353f uart: update stm32 uart to support LL clock control driver
After introducing STM32Cube based clock control driver for
stm32 family, update stm32 serial driver to support it.
Once supported across the whole family, a clean up will be done.

Change-Id: I7100bc699e7918c8be71d58091da1860ab734e25
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 293b65f526 pinmux: update stm32 pinmux to support LL clock control driver
After introducing STM32Cube based clock control driver for
stm32 family, update pinmux driver to support it.
Once supported across the whole family, a clean up will be done.

Change-Id: Icc20816377f3a09f516a743462c92696a1fead3a
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 375b7171b4 gpio: update stm32 gpio to support LL clock control driver
After introducing STM32Cube based clock control driver for
stm32 family, update GPIO driver to support it.
Once supported across the whole family, we clean up will be done.

Change-Id: If50cb580cb01dc1d38557e54f19a8260feaa504e
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 58c8d15147 clock control:stm32: provide STM32Cube LL based driver
This new clock control driver aims at providing a lightweight
generic driver to the whole stm32 family.
Driver is based on LL Cube API and hence is for now available
only for STM32 supporting this API: stm32f3xx and stm32l4xx.
Other families should be supported soon.
Once globally supported, this unique driver will also help
reducing the impact of stm32 clock control heterogeneity in
other drivers.

Change-Id: Id15a8d0d44f03809b2907ef10d6877700459e674
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Bogdan Davidoaia 5b02ba8319 kw41z: add base DTS support
This patch adds the base DTS support for the KW41Z Freedom board. The
initial set of changes include SRAM, FLASH, IRQ controller and LPUART
support.

Change-Id: Ic68c4959ddad0c5cfe70d5576a0e58372b93ec9d
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-02-10 18:14:05 +00:00
Vincenzo Frascino 0da2a03234 v2m_beetle: uart: Add DTS support to UART driver
This patch adds DTS support to the ARM CMSDK UART driver.  The DTS
currently specifies the IRQ, IRQ PRIO, and base address of the port.

Change-Id: I8e5bc81c013958be4297d563495bf126b53a83a9
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-02-10 18:14:04 +00:00
Andy Gross 670aa0cc99 stm32: uart: Add DTS support to STM32 UART driver
This patch adds device tree support to the STM32 UART driver.  The base
address, interrupt, and interrupt priority values can now come from DTS.

Change-Id: I3c383da8b200037601ecb2dc087f99ef103761bb
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-02-10 18:14:02 +00:00
Gil Pitney b465fbe312 cc3200: Enable device tree usage for CC3200
This patch ifdef's out information that would be redefined by
information generated from DTS.  This patch also fixes up the serial
drives to work properly with the DTS generated information.

Change-Id: I912ccf35be23c107705a4866e5a68b3b51154ffa
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-02-10 18:14:01 +00:00
Andy Gross ddce7dea40 dts: arm: Kinetis: Add base support for Kinetis
This patch adds DTS support and related files for the NXP Kinetis
platform.  The DTS files contain the base definitions for the hardware
nodes on Kinetis platforms.  The YAML files provide the definitions of
the contents of the DTS nodes.

The Kconfig changes were put in place to allow for the conversion of
existing drivers.  Once those drivers are modified, the Kconfig options
that are replaced by the DTS information will be removed.

Change-Id: If110fffa99c0b12471cf2df206da6687277e4756
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-02-10 18:13:59 +00:00
Anas Nashif 8c7aa9aa85 Merge "Merge bluetooth branch into master" 2017-02-10 16:37:56 +00:00
Juan Solano ee623d21de drivers: Remove unnecessary CONFIG_SYS_POWER_DEEP_SLEEP
This commit removes unnecessary CONFIG_SYS_POWER_DEEP_SLEEP protection
in shim drivers as QMSI 1.4 has introduced empty context save/restore
functions that can be called in Quark D2000, therefore keeping common
code at the shim driver level for Quark SE and D2000.

Change-Id: Ia2a466327f999668c6511c0193014e9151bff6ae
Signed-off-by: Juan Solano <juanx.solano.menacho@intel.com>
2017-02-10 16:27:32 +00:00
Luiz Augusto von Dentz 2e444cb34c drivers: Convert FOR_EACH macro instances to use CONTAINER
Change-Id: Ifc08d39fe84f522e071d3b9e32479798bbd89c6c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-10 16:16:16 +00:00
Johan Hedberg 01c821f56f Merge bluetooth branch into master
Some more Bluetooth fixes for 1.7.0-rc1.

----------------------------------------------------------------
Arun Jagadish (1):
      Bluetooth: AVDTP: Moving structures to headerfile

Johan Hedberg (1):
      Bluetooth: Fix missing connection cleanup in some scenarios

Luiz Augusto von Dentz (1):
      Bluetooth: GATT: Fix not updating previous node

Prasanna Karthik (1):
      Bluetooth: nble: Catch and handle non-zero fn_index

Szymon Janc (1):
      Bluetooth: Fix not clearing signaled flag for conn_change signal

 drivers/bluetooth/nble/rpc_deserialize.c |  3 +-
 subsys/bluetooth/host/avdtp.c            | 10 ----
 subsys/bluetooth/host/avdtp_internal.h   | 13 +++++
 subsys/bluetooth/host/conn.c             | 49 +++++++++++------
 subsys/bluetooth/host/conn_internal.h    |  1 +
 subsys/bluetooth/host/gatt.c             |  1 +
 6 files changed, 48 insertions(+), 29 deletions(-)

Change-Id: If1d53d9767d89080480ce5147156adeeb26565dc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-10 18:03:51 +02:00
Anas Nashif df16cb92d4 arduino_101: bmi160: use new device name
Use new device name for SPI device

Jira: ZEP-1704
Change-Id: Iec39468bbef54423af2b3a681dd4ae1eee866d1e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-10 16:02:22 +00:00
Prasanna Karthik 6545aa3f52 Bluetooth: nble: Catch and handle non-zero fn_index
Avoid multiple breaks and gracefully catch non-zero values of fn_index

Change-Id: I1cf7b271b8478e63af2da1f40b4caceb63d7ce90
Signed-off-by: Prasanna Karthik <pkarthik@intrinsyc.com>
2017-02-10 12:03:09 +00:00
Baohong Liu 15b44146cd drivers: dma_shim: update dma qmsi shim driver
Update the qmsi dma shim driver based on the new dma api
interface.

Recently, a RFC was posted to update the dma api. The update
to dma api interface was already posted. This change is to
update the dma qmsi shim driver based on the dma api change.
It is using the new data structures and new api function names.

Jira: ZEP-873

Change-Id: If9a772c5ff1c2b10fca05172c48f75223bbf940e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-02-10 02:18:16 +00:00
Jean-Paul Etienne 5d5265bca4 riscv32: timer: disable riscv_machine_timer driver by default for riscv32
Enabling the riscv_machine_timer driver by default for riscv32
causes compilation issues on riscv32 boards (like zedboard_pulpino)
not supporting it.

Boards supporting the driver enable it via their respective
config file.

Change-Id: Ieb0d25fa339834fd386ae2725f40b6b7b72dc52b
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-02-09 00:26:26 +01:00
Kuo-Lang Tseng 0e91e84122 drivers: QMSI PWM: simplify driver reentrancy code using IS_ENABLED macro
This is one the series patches that simplifies the driver code by
using the IS_ENABLED macro. This removes the need of the const
variable and the wrapper functions on semaphore APIs.

Jira: ZEP-1251

Change-Id: Ic2df5d04966d2a066478ca3e119f76d24fc4dfb3
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-02-08 19:08:31 +00:00
Kuo-Lang Tseng 8bf14d380b drivers: QMSI RTC: simplify driver reentrancy code using IS_ENABLED
This is one of the series of patches that simplifies the driver
code by using the IS_ENABLED macro. This removes the need of the
const variable and the wrapper functions on semaphore APIs.

Jira: ZEP-1251

Change-Id: I84a09a0aaa3a00452d8c2b4bca7be0f6b2015218
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-02-08 19:08:06 +00:00
Kuo-Lang Tseng 74f7da1bb4 drivers: QMSI SOC flash: simplify driver reentrancy code using IS_ENABLED
This is one the series patches that simplifies the driver code by
using the IS_ENABLED macro. This removes the need of the const
variable and the wrapper functions on semaphore APIs.

Jira: ZEP-1251

Change-Id: I59802cf9f482337656b0fdc4b272f3b1ddc6cbda
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-02-08 19:07:42 +00:00
Juan Solano 48b8dddd95 aonpt_qmsi: Call QMSI 1.4 context save/restore functions.
This commit removes the aonpt interrupt masking/unmasking needed after
wake up as that functionality is now available in QMSI 1.4. The QMSI
save/restore functions are called instead.

Change-Id: I61a4a6952e959d0834904bbc8e1eb98092ae4b1c
Signed-off-by: Juan Solano <juanx.solano.menacho@intel.com>
2017-02-08 13:40:51 +00:00
Juan Solano e19000603b rtc_qmsi: Call QMSI 1.4 context save/restore functions.
This commit removes the RTC interrupt masking/unmasking needed after
wake up as that functionality is now available in QMSI 1.4. The QMSI
save/restore functions are called instead.

Change-Id: I15b5063fa64c71b125edd2c709410b5ae655032e
Signed-off-by: Juan Solano <juanx.solano.menacho@intel.com>
2017-02-08 13:39:54 +00:00
Marcus Shawcroft fd604a3a9a gpio: Error unsupported access_op consistently.
Several GPIO device drivers support only one of the two possible
access_op modes and return an errno error code for the mode they do
not support.  Use the same errno code across all drivers.

Change-Id: Ic01ce9dee7fb2405d254c60cebee22053c803270
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-08 13:31:09 +00:00
Marcus Shawcroft 48831a9d4c gpio: Error pin out of range consistently.
Several GPIO drivers detect an out of range pin number and return an
errno error code.  Use the same errno code across all drivers.

Change-Id: I0e2949432d6845d12c37064c78f9c228b8e8e45a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-08 13:31:08 +00:00
Marcus Shawcroft c35b90890a gpio: Error GPIO_INT with GPIO_DIR_OUT consistently.
Several gpio drivers consider GPIO_INT with GPIO_DIR_OUT to be illegal
and return an errno code.  Use the same errno code across all drivers.

Change-Id: I1594df0cfdf96194685c83c34dff36261896f2de
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-08 13:31:08 +00:00
Ramesh Thomas 444ecafeee kernel: Remove redundant TICKLESS_IDLE_SUPPORTED option
This flag is no longer necessary and TICKLESS_IDLE will be
enabled by default if SYS_POWER_MANAGEMENT is enabled.

Jira: ZEP-1325
Change-Id: Ic6cd4b8dc0a17c6a413cabf6509b215a4558318d
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-02-08 13:02:34 +00:00
Anas Nashif 31f01f8ed6 Merge "Merge net branch into master" 2017-02-08 12:03:09 +00:00
Kuo-Lang Tseng 23b0074012 ext qmsi: Update to QMSI 1.4 RC2
Update the builtin QMSI code to 1.4 (RC2).
The below shim drivers were updated for API or interface changes:
- aio
- counter
- i2c_ss
- rtc
- wdt.

Also, arch soc specific power management code were updated.

Jira: ZEP-1572

Change-Id: Ibc8fae032a39ffb2c2c997f697835bc0208fd308
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-02-08 11:59:12 +00:00
Johan Hedberg 79883c9834 Merge bluetooth branch into master
- Use k_poll to consolidate all TX threads into a single one
 - Reuse HCI command buffers for storing their response
 - Improvements to SDP client support
 - New "volatile subscription" flag to GATT API
 - Various smaller fixes & cleanups here and there

----------------------------------------------------------------
Arkadiusz Lichwa (8):
      Bluetooth: SDP: Get ProtocolDescriptorList attribute internals
      Bluetooth: shell: Add SDP client support
      Bluetooth: uuid: Fix assigned UDP uuid value
      Bluetooth: SDP: Add API to get ProfileDescriptorList attribute
      Bluetooth: shell: Add getting ProfileDescriptorList attribute
      Bluetooth: SDP: Add API to get SupportedFeature attribute
      Bluetooth: shell: Use SupportedFeature attribute API
      Bluetooth: shell: Add support to retrieve A2SRC record

Arun Jagadish (2):
      Bluetooth: AVDTP: Remove buffer pool
      Bluetooth: AVDTP: Add AVDTP Discover Function Definition

Carles Cufi (1):
      Bluetooth: hci_core: Use nRF5x FICR address

Jaganath Kanakkassery (2):
      Bluetooth: RFCOMM: Fix session timer during acl disc
      Bluetooth: RFCOMM: Use common tx pool for control packets

Johan Hedberg (15):
      Bluetooth: Fix trivial coding style issue
      Bluetooth: Fix checking for invalid public address
      Bluetooth: Fix using correct variable type for interrupt mask
      Bluetooth: Fix buffer leak when HCI driver send() fails
      Bluetooth: drivers/h4: Add support for discarding certain events
      Bluetooth: Add convenience macros for common header sizes
      Bluetooth: Kconfig: Merge headroom reserve variables into a single one
      Bluetooth: Controller: Redesign response buffer allocation for commands
      Bluetooth: Reuse HCI command buffers for the command response
      Bluetooth: conn: Use delayed work for LE connection timeout
      Bluetooth: Merge bt_conn TX threads into a single one with k_poll
      Bluetooth: Merge HCI command and connection TX threads
      Bluetooth: samples: Add missing README.rst files
      Bluetooth: Controller: Use LL_ASSERT instead of BT_ASSERT
      Bluetooth: Fix incorrect checks for command buffer user data

Jonathan Gelie (3):
      Bluetooth: GATT: introduce volatile subscription flag
      Bluetooth: GATT: set subscribe value to zero for unsubscription
      Bluetooth: GATT: fixing unsubscription

Luiz Augusto von Dentz (1):
      Bluetooth: GATT: Fix not removing subscriptions safely

Sathish Narasimman (5):
      Bluetooth: HFP HF: Service level connection completed
      Bluetooth: HFP HF: Enable extended AG Error Result Code
      Bluetooth: HFP HF: Indicate disconnect to application
      Bluetooth: HFP HF: Disconnect rfcomm on SLC error
      Bluetooth: HFP HF: Remove unused variable 'buf'

Szymon Janc (5):
      Bluetooth: Use assert when getting net buf with K_FOREVER
      Bluetooth: Remove some dead code
      Bluetooth: L2CAP: Remove dead code
      Bluetooth: SDP: Make bt_sdp_create_pdu static
      Bluetooth: L2CAP: Make l2cap_br_send_conn_rsp return void

 drivers/bluetooth/hci/Kconfig                   |  13 +-
 drivers/bluetooth/hci/h4.c                      |  93 +++-
 drivers/bluetooth/hci/h5.c                      |  47 +-
 drivers/bluetooth/hci/spi.c                     |  13 +-
 drivers/bluetooth/nble/gatt.c                   |  76 +--
 include/bluetooth/buf.h                         |  13 +-
 include/bluetooth/gatt.h                        |  18 +-
 include/bluetooth/hci.h                         |   9 +-
 include/bluetooth/l2cap.h                       |  20 +-
 include/bluetooth/sdp.h                         |  51 ++-
 include/bluetooth/uuid.h                        |   2 +-
 samples/bluetooth/handsfree/README.rst          |  23 +
 samples/bluetooth/hci_uart/src/main.c           |  11 +-
 samples/bluetooth/hci_usb/src/main.c            |  11 +-
 samples/bluetooth/peripheral_sc_only/README.rst |  26 ++
 subsys/bluetooth/controller/hci/hci.c           | 153 ++++---
 subsys/bluetooth/controller/hci/hci_driver.c    |  23 +-
 subsys/bluetooth/controller/hci/hci_internal.h  |   2 +-
 subsys/bluetooth/controller/ll/ctrl.c           |   2 +-
 subsys/bluetooth/host/Kconfig                   |  10 +-
 subsys/bluetooth/host/at.c                      |   2 +-
 subsys/bluetooth/host/at.h                      |   3 +-
 subsys/bluetooth/host/avdtp.c                   |  81 +++-
 subsys/bluetooth/host/avdtp_internal.h          |   7 -
 subsys/bluetooth/host/conn.c                    | 178 ++++----
 subsys/bluetooth/host/conn_internal.h           |  15 +-
 subsys/bluetooth/host/gatt.c                    | 142 +++---
 subsys/bluetooth/host/hci_core.c                | 285 ++++++++----
 subsys/bluetooth/host/hci_core.h                |   6 +
 subsys/bluetooth/host/hci_ecc.c                 |   6 +-
 subsys/bluetooth/host/hci_raw.c                 |  12 +
 subsys/bluetooth/host/hfp_hf.c                  |  50 +-
 subsys/bluetooth/host/l2cap.c                   |  35 --
 subsys/bluetooth/host/l2cap_br.c                |  49 +-
 subsys/bluetooth/host/l2cap_internal.h          |   7 +-
 subsys/bluetooth/host/rfcomm.c                  |  31 +-
 subsys/bluetooth/host/rfcomm_internal.h         |   5 +-
 subsys/bluetooth/host/sdp.c                     | 584 +++++++++++++++++++++++-
 tests/bluetooth/shell/src/main.c                | 172 +++++++
 39 files changed, 1700 insertions(+), 586 deletions(-)
 create mode 100644 samples/bluetooth/handsfree/README.rst
 create mode 100644 samples/bluetooth/peripheral_sc_only/README.rst

Change-Id: I7589dbad8b97477c72d1b856121593bcf6d11339
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-08 13:03:20 +02:00
Jonathan Gelie 048a15bcc8 Bluetooth: GATT: fixing unsubscription
If subcription was found within the subscription list,
we have check if remains identical subscription
from the next node.
Otherwise none unsubscription is realized.

Change-Id: I38132d7c80575801885b8057902f3d4666b08aea
Signed-off-by: Jonathan Gelie <jonathanx.gelie@intel.com>
2017-02-08 11:00:06 +00:00
Jukka Rissanen bd3908b2a9 net: nbuf: Add timeout to net_buf getters
This commit changes the net_buf getter functions in nbuf.h
by adding a timeout parameter. These function prototypes
are changed to accept a timeout parameter.
	net_nbuf_get_rx()
	net_nbuf_get_tx()
	net_nbuf_get_data()
	net_nbuf_get_reserve_rx()
	net_nbuf_get_reserve_tx()
	net_nbuf_get_reserve_data()
	net_nbuf_copy()
	net_nbuf_copy_all()
	net_nbuf_push()
	net_nbuf_append()
	net_nbuf_write()
	net_nbuf_insert()

Following convinience functions have not been changed
	net_nbuf_append_u8
	net_nbuf_append_be16
	net_nbuf_append_be32
	net_nbuf_insert_u8
	net_nbuf_insert_be16
	net_nbuf_insert_be32
	net_nbuf_write_u8
	net_nbuf_write_be16
	net_nbuf_write_be32
so they call the base function using K_FOREVER. Use the
base function if you want to have a timeout when net_buf
is allocated.

Change-Id: I20bb602ffb73069e5a02668fce60575141586c0f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-08 10:12:35 +02:00
Wojciech Bober 573774a9bf drivers/net/ieee802154: Change configuration prefix
This commit changes Kconfig prefix for ieee802154 drivers to
IEEE802154_*. This is done for consistency with config prefixes
used in other subsystems.

Change-Id: Ibbb4d96d2b748f4f13135bde85304ec34c5a90a6
Signed-off-by: Wojciech Bober <wojciech.bober@nordicsemi.no>
2017-02-08 10:12:35 +02:00
Jukka Rissanen b4ca6e8300 drivers/eth/mcux: Free net_buf using net_nbuf_unref
The driver was using net_buf_unref(). This technically works
ok but debugging the network buffer allocations is more
difficult if done like this.

Change-Id: If3453a49337c7a359c8af22cfdf331fccc697af5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-08 10:12:34 +02:00
Johann Fischer baa4939b94 drivers: mcr20a: control access to SPI with semaphore
Change-Id: I5498452d11c435ca3e4d3889ef8e9b19b031782a
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-02-08 10:12:34 +02:00
Wojciech Bober c84b765fdd drivers/ieee802154: Split drivers Kconfig
This commit splits 802.15.4 drivers configuration into separate files.

Change-Id: Ie1bed862e8f4248240fef18bc211d0ee8ca1493c
Signed-off-by: Wojciech Bober <wojciech.bober@nordicsemi.no>
2017-02-08 10:12:34 +02:00
Juan Manuel Cruz 35011815f3 drivers: enc28j60: Enables reception of multicast packets
Jira: ZEP-1544

Change-Id: I96a7f9cd40612c1eaebac79845f4a3157a8f7457
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2017-02-08 10:12:34 +02:00
Marcus Shawcroft ec86145adf i2c/dw: Switch from EPERM to EIO
The DW i2c driver chooses to return -EPERM following a PCI error in
driver configuration.  This seems an odd choice.  All of the other I2C
drivers return -EIO for general failures detected during driver
configuration.

Switch the DW driver from EPERM to EIO.

Change-Id: Ia4f96386620319736ae4c09212b0a05ea38169b1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-07 18:32:37 +00:00
Marcus Shawcroft ccf16c705d i2c/stm32lx: Fix layout.
Change-Id: Ifc474ff703f96e5edd9dfd280533f4d8fe6a6853
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-07 18:32:36 +00:00
Marcus Shawcroft ddb6b94bd7 i2c: Implement consistent i2c no msgs behaviour
The I2C drivers handle an empty list of I2C messages inconsistenty.
There are two different behaviours, one set of drivers dectects a
requests to transfer zero messages and return -EINVAL while the other
group simple transfer no data and return success.

Adopt the latter behaviour consistently across all drivers.  Update
the i2c.h API documentation to reflect this behaviour.

Change-Id: I427fc1b0e18ddc04b7b59c294e0240b3d6ca4073
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-07 18:32:35 +00:00
Jonathan Gelie a42e4f694f Bluetooth: GATT: set subscribe value to zero for unsubscription
Subscribe value is set to zero before calling notify callback,
to distinguish a subscription failure from an unsubscription
on disconnection (when flag BT_GATT_SUBSCRIBE_FLAG_VOLATILE is set).

Change-Id: Ia91220492d82041b2c385bf88a15180387e7a483
Signed-off-by: Jonathan Gelie <jonathanx.gelie@intel.com>
2017-02-06 17:44:01 +00:00
Jonathan Gelie b3ac77becd Bluetooth: GATT: introduce volatile subscription flag
Some application protocol required non-persistente subscription
across connection even in bonded case.
Flag BT_GATT_SUBSCRIBE_FLAG_VOLATILE specify if subscription
must be remove during disonnection.

Change-Id: I1bc2bbbb4bc86f58905e44a7eb267ca0871f2fdb
Signed-off-by: Jonathan Gelie <jonathanx.gelie@intel.com>
2017-02-06 17:43:18 +00:00
Marcus Shawcroft 7803123d3b gpio/nrf5: Implement port read and write
Implement the missing port read and write behaviour.

Change-Id: I0928379eddf81d806a0ae6b75a1ea2993c3a28ff
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-06 13:15:50 +00:00
Marcus Shawcroft 142bce58a2 gpio/nrf5: Fix GPIO_ACCESS_BY_PIN behaviour
Adjust the implementation of gpio_pin_read() to return 0 or 1 rather
than 0 or 2^pin.  This ensures consistent behaviour with other gpio
device drivers, and conforms to the behaviour documented in gpio.h by
the previous patch.

Change-Id: Ia02aa68105a406f355d16a3f9b0550f948658483
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-06 13:15:50 +00:00
Luiz Augusto von Dentz 31016448b4 Bluetooth: GATT: Fix not removing subscriptions safely
The subscriptions callback may free or reuse the subscription so all
instances that where this could happen need to safely fetch the next
element which is why this changes switch to use sys_list_t as it has
SYS_SLIST_FOR_EACH_NODE_SAFE.

Change-Id: I37d51f27116ea0c057b560924a9416676477597b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-06 11:18:57 +00:00
Johan Hedberg 50678b03cb Bluetooth: Reuse HCI command buffers for the command response
Reduce the pressure on the common RX buffer pool by reusing HCI
command buffers also for the Command Status or Command Complete
response to them. This also implies removing the existing Kconfig
variable for the command buffer sizes since the size is also dependent
on maximum Command Complete event sizes. Instead, reuse the RX buffer
size also for HCI Command buffers.

Change-Id: I006b287d64a0c9ca40de741aa9a424a49a927385
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-05 22:39:25 +02:00
Johan Hedberg 743379c21f Bluetooth: Kconfig: Merge headroom reserve variables into a single one
A subsequent patch will start reusing HCI command buffers for
receiving the response, so the distinction of received vs sent data
headroom would just make the code unnecessarily complex. Instead, just
merge these two variable into a single one.

Change-Id: I31d846331939f1a2270df7ed0c75112825e16493
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-05 22:39:25 +02:00
Johan Hedberg bbf389aae6 Bluetooth: drivers/h4: Add support for discarding certain events
If we are low on RX buffers and receive an LE Advertising Report or a
BR/EDR Inquiry response we should just discard this. If we don't
discard the event we increase the risk of deadlock where the RX
interrupt is enabled but bt_recv() is doing a synchronous HCI command
sending, i.e. waiting for a cmd_status/cmd_complete (which will never
come since the RX interrupt is disabled).

Change-Id: I6266625c9790d68bcf8e8718c8c36f127946c4c6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-05 22:39:25 +02:00
Baohong Liu 08f5c26115 drivers: bmi160: add sample ready check
Add sensor sample ready check before fetching the sample.
Otherwise, invalid value will be returned.

Jira: ZEP-1532 ZEP-1358

Change-Id: I570151c8ae93fbb744dac857521f596fd63806a6
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-02-04 19:45:31 +00:00
Jean-Paul Etienne c989f0b408 riscv32: timer: replace riscv_qemu_driver by the generic riscv_machine_driver
riscv defines the machine-mode timer registers that are implemented
by the all riscv SOCs that follow the riscv privileged architecture
specification.

The timer registers implemented in riscv-qemu follow this specification.
To account for future riscv SOCs, reimplement the riscv_qemu_driver by
the riscv_machine_driver.

Change-Id: I645b03c91b4e07d0f2609908decc27ba9b8240d4
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-02-03 19:20:52 +01:00
Sergio Rodriguez 1bbfd3effe driver: ethernet: Fix typo on enc28j60 driver Kconfig
Change-Id: Ie7178db2da5e4de476192516dfb9ff3a5e8f082a
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-02-03 15:59:14 +02:00
Anas Nashif 9f004d9b7c drivers: make ethernet init prio depend on NET_L2_ETHERNET
Change-Id: I5e72e7ba53e65e5ebc2b41fa30b84513fe10c998
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-02 14:43:51 +00:00
Piotr Mienkowski d519ef17b7 drivers: Add Atmel SAM family GMAC Ethernet driver
This is a zero-copy networking implementation of Ethernet driver.

Limitations:
- one shot PHY setup, no support for PHY disconnect/reconnect
- no support for devices with DCache enabled due to missing
  non-cacheable RAM regions in Zephyr.

Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-1492
Change-Id: Ib944f91193efbd12c1142b0bcf1f635388bf1b87
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-02-01 21:01:19 +00:00
Piotr Mienkowski 9d1c6de608 drivers: Add basic Atmel SAM USART driver
Added basic USART driver for Atmel SAM MCU family. USART is a very
comprehensive module, currently only basic features sufficient to
support printf functionality are implemented by this driver.

Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-978
Change-Id: Ia9710e4069243fb6c30de45953dfc1fe1266b63a
Signed-off-by: Piotr Mienkowski <Piotr.Mienkowski@schmid-telecom.ch>
2017-02-01 21:01:18 +00:00
Marcus Shawcroft f5eeaf9527 i2c/nrf5: Remove r/w to POWER register.
The reset code that toggles the POWER register fails to build on
NRF52.  In discussion with the Nordic folks it transpires that we
don't actually need this code.

For future reference there is a related errata here:
http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.Rev1.errata/anomaly_832_89.html?cp=2_2_1_0_1_26

Change-Id: I2ba8c2bb814f8f95ff3f340862c75a8bc437c573
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-02-01 00:35:35 +00:00
Anas Nashif d159c8e476 Merge "Merge arm branch into master" 2017-01-30 18:22:45 +00:00
Chuck Jordan ac34b99af3 i2c: Can pass IRQ vector constant to irq_enable
I found that I was not getting the i2C interrupt.
When CONFIG_I2C_0_IRQ_DIRECT=y, it is acceptable to just
pass the constant to irq_enable.

See ZEP-1651.

Change-Id: I10955e6d6fe5fdd2dda916c92c8bc8a2e871f41a
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2017-01-30 17:52:58 +00:00
Kumar Gala f85dbb1b34 arm: cmsis: Convert _ScbExcPrioSet to NVIC_SetPriority
Replace _ScbExcPrioSet with calls to NVIC_SetPriority as it handles both
interrupt and exception priorities.  We don't need to shift around the
priority values for NVIC_SetPriority.

Jira: ZEP-1568

Change-Id: Iccd68733c3f7faa82b7ccb17200eef328090b6da
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-30 11:02:36 -06:00
Maureen Helm e290006144 serial: Introduce new mcux lpuart shim driver
Adds a shim layer around the mcux lpuart driver to adapt it to the Zephyr
serial interface.

NXP has multiple uart hardware blocks that implement different features
and have different register maps. The k64 has a uart block called
'uart', while the kw41 has a uart block called 'lpuart' (low power
uart). The MCUXpresso SDK provides separate drivers for each type of
uart block but with similar software interfaces. As a result, there are
also separate shim drivers in Zephyr. There is a 1:1:1 relationship
between hardware block, mcux driver, and mcux shim driver.

Because we now have two mcux shim drivers for the uart interface, a new
naming convention is created:

	<interface>_mcux_<hw block>

Where <interface> is the name of the Zephyr interface, in this case
'uart'. This convention is not new.

<hw block> is the name of the NXP hardware block, in this case 'lpuart'.
This is the new part, and distinguishes different hardware blocks
for the same interface.

Change-Id: I3a80b9bffa116bbb2b02ee950d4bdd79a19a4edc
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-30 11:02:35 -06:00
Maureen Helm ec5ee8b33d flash: Update mcux shim to new mcux version
The newer version of mcux changes its flash api slightly, so update the
Zephyr shim accordingly.

Change-Id: I0c974fc3e82b9f40372c636f0b805ed143be2198
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-30 11:02:35 -06:00
Anas Nashif 66417c0246 Merge "Merge net branch into master" 2017-01-29 04:31:39 +00:00
Ricardo Salveti a3474a731e Bluetooth: SPI: Disable IRQ pin callback to avoid spurious IRQs
Avoid spurious IRQ when already handling the SPI Slave IRQ.

Change-Id: If8452a668bc9768d462a5fa56b851e99a076e67c
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-28 08:43:41 +02:00
Ricardo Salveti 2569e2e8d1 Bluetooth: SPI: retry spi_transceive calls if invalid
spi_transceive can return successfuly even if the data provided by the
slave is invalid, so check if the content is correct and retry until a
valid data is available.

Change-Id: Ia951de391e0b24c5b41eeabfb5c10b056d32b62e
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-28 08:43:41 +02:00
Ricardo Salveti f27d8eef39 Bluetooth: SPI: switch to a single SPI transfer when receiving
Change-Id: I27b504032080bddf7ebc88ef4812a0e7eab691c6
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-28 08:43:41 +02:00
Ricardo Salveti 8227c72c47 Bluetooth: SPI: fix max SPI buffer length
Drop the BLUETOOTH_SPI_RX_BUFFER_SIZE and BLUETOOTH_SPI_TX_BUFFER_SIZE
config options by fixing the max SPI buffer length to 255, as used by
the X-NUCLEO-IDB04A1 BSP. This simplifies the rx/tx buffer handling, and
avoids a potential spi rx stack overflow depending on the config values
set by the user.

Change-Id: Ifa7fd086016abda4bdcf9638f28b38d001a288c5
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-28 08:43:41 +02:00
Ricardo Salveti 4afe063aad Bluetooth: SPI: introduce CONFIG_BLUETOOTH_SPI_BLUENRG
This new option is used to encapsulate the logic specific to devices
implementing the BlueNRG Bluetooth stack (e.g. X-NUCLEO-IDB05A1).

The current BlueNRG specific logic covers the HCI Reset handling and
the manual control of the SPI Chip Select line (normally not needed since
spi_transceive is also responsible for controlling the SPI CS line).

Change-Id: I5db4addf873eee0af2d957e2181c50aac53ab656
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-28 08:43:41 +02:00
Ricardo Salveti ef7f2bd54e Bluetooth: SPI: fix Kconfig SPI IRQ PIN description
Change-Id: I4c25062e922cd05ca738222182909c261b55abca
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-28 08:43:41 +02:00
Johan Hedberg 4153b6ca1f Bluetooth: Kconfig: Make device name variable generic
Change BREDR_NAME to DEVICE_NAME so it can also be used as the LE
device name.

Change-Id: I9ef55d9dff098372d47d9d5754ad7a7163a65bc0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-28 08:43:41 +02:00
Ricardo Salveti e2b759bc69 Bluetooth: SPI: fix buf handling for HCI ACL packets
Code was assuming that all the HCI messages were events, causing invalid
data length when receiving HCL ACL packets.

Change-Id: I8c1a07f46b6b62a04e242cf29ee1119f59d4bda6
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-28 08:43:41 +02:00
Bogdan Davidoaia a45dd12f0c sensor: use SENSOR_CHAN_*_XYZ instead of SENSOR_CHAN_*_ANY
SENSOR_CHAN_*_ANY will be deprecated, so use the new SENSOR_CHAN_*_XYZ
enum values.

Change-Id: I91cf25864613a934feab65588969d10c52fd4fe6
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-27 19:07:17 +00:00
Tomasz Bursztyka 028896063f drivers/console/telnet: Select TCP when telnet is selected
Thus users won't have to first enable network stack and then telnet.

Change-Id: I30cb2b9debee3feaf804f9a70f9d3f90758f5f17
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 13:02:11 +00:00
Tomasz Bursztyka 83ed3a29be net/ieee802154: Modify radio TX function signature
The cause for this change is TCP. Until now, the radio strategy driver
(ALOHA or CSMA) was providing the actual nbuf, and not the buffer
fragment, counting on the fact that the loop was using
net_buf_frag_del() which made so, iteration after iteration, buffer
framgent to be always buf->frags. The problem with this logic is loosing
the fragments that might be still referenced by TCP, in case the whole
buffer did not make it so TCP can retry later and so on.

Instead, TX now takes the nbuf and the actual frag to send. It could
have been working with just a pointer on the data, and the whole length
of the frame. But it has been avoided due to possible future devices,
that will be smarter and run CSMA directly in the hw, thus it will
require to access the whole buffer list through the nbuf.

Change-Id: I8d77b1e13b648c0ec3645cb2d55d1910d00381ea
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka c5644fba20 drivers/console/telnet: Add ground support for telnet commands
This is the skeleton for such support. Let's see if this will be needed
and thus extended in the future.

For now, it's disabled by default, not advised to be enabled.
It supports AYT, AO and DO/SUPR_GA. This is very limited and only there
to show how it could be handled.

Change-Id: I736bfa23145e9b727af08db682ab001f494f8c8d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka 1d9402b3e3 drivers/console/telnet: Provide minimal input handling.
Telnet "Interpret As Command" (IAC) code is ignored.

Change-Id: I882397389d77b8adfcbce62fbd9654c0b0412ae3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka 2f1af492ee console/shell: Switch to generic console input
Let's use the generic console input type now. This will be useful for
other console input drivers such as telnet.

Change-Id: I787a1e9d86481d5f8c4803453726d9042a89dea4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka 3e65158936 drivers/console: Making console input generic
Input line length can be modified via Kconfig.

Change-Id: I3423fce9814e04b11d11e5d391f85fe1efbe8d17
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka fb9810978f drivers/uart_console: Fix tiny style issues
Basically missing {} on if statements.
Taking the opportunity to remove a useless switch.

Change-Id: Ic6b3951dfc257cb46d858ebcd12bdf1b4e7ff997
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka 01e70f4189 drivers/console: Add a basic telnet console
Telnet is started as an application, as it requires the net stack to be
ready. It will listen to any IP address on both protocols (IPv4, IPv6),
depending of course on which one is enabled.

Current behavior is very basic, as it does not handle any telnet
command (IAC). These will be silently ignored.

Jira: ZEP-1601

Change-Id: Id50656f23e6347bbbc893416953f1ba7116ef87d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:52 +02:00
Tomasz Bursztyka 4984ca742a drivers/console: Removing non existing Kconfig source
Change-Id: I89fdc6f702f3ea39822c6fbf6fce93e3eb77261c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:52 +02:00
Andrei Emeltchenko 404a83a482 drivers: cc2520: Remove unused TI_CC2520 Kconfig option
Instead of TI_CC2520_CHANNEL option NET_L2_IEEE802154_ORFD_CHANNEL is
used.

Change-Id: I9b0c0ff6b2c42070d05c5cf3e4dc33c364be9a5c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-01-27 12:35:52 +02:00
Johann Fischer fa8d9c9d10 drivers: ieee802154: add MCR20A driver
Add driver and configuration for the MCR20A 802.15.4
transceiver.

Jira: ZEP-1429

Change-Id: I0b17b688220a47c2f0e5cde269064bbd0dec824a
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-01-27 12:35:51 +02:00
Maureen Helm 8575a36dbe fxos8700: Fix broken gpio callback implementation
Fixes fxos8700_gpio_callback() to pass a pin number to
gpio_pin_disable_callback() rather than a pin mask.

Jira: ZEP-1507

Change-Id: I15bfbf4d3377f22942aa549377472d2b1142c32b
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-26 11:57:22 +00:00
Anas Nashif 0a3738019f pinmux: unify galileo pinmux driver
Remove dev driver and integrate it in the default pinmux driver.

Jira: ZEP-958
Change-Id: I55670240f8a21749d3a6ae22e300e16ba80a2fb6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-25 20:43:18 +00:00
Anas Nashif 42e1c9ca34 pinmux: make pinmux_dev the default pinmux driver for quark
Jira: ZEP-958
Change-Id: Ib6c528a103372d5084efa5ae8635803e2912e0dd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-25 20:43:18 +00:00
Marcus Shawcroft 2dd2dfc3f9 i2c/nrf5: Implement NRF5 I2C driver.
Basic interrupt driven i2c driver for the NRf5 series.

The NRf5 series hardware imposes a constraint that various peripherals
cannot be used simultaneously.  This driver does not implement mutual
exclusion against SPI, or SPIs drivers (yet).

Change-Id: I308d93bc486eef95db7b95c6b7c9beafc0d7e97f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-25 09:59:27 +00:00
Marcus Shawcroft df632a7371 i2c: Sort Makefile in alphabetical order.
Change-Id: Id0b39b95a7f378d728ddbe0b92518af054072252
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-25 08:47:22 +00:00
Marcus Shawcroft 8324e93812 gpio/nrf5: Support drive strength configuration.
Extended the nRF5 GPIO driver to support configurable pin drive
strengths.

Change-Id: I59c42b8a69cc37b594c2388b892d3accd7b19807
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-25 08:47:21 +00:00
Baohong Liu 77b7cb90d3 drivers: spi: enable gpio driver automatically when needed
Enable gpio driver automatically when an app or upper
level driver needs it as chip select for spi.

Change-Id: I2bed134939426e2c84f313393d638a878c84fbfc
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-01-24 13:47:22 +00:00
Bogdan Davidoaia 9f7a643310 sensor: fxos8700: expand trigger requirement to include pulse config
The pulse config option requires triggers enabled, so expand the
trigger requirement to also include all the pulse configs.

Change-Id: Ib94f4071cac757b24bfe940ca64fd11b07fed1c1
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-24 13:45:16 +00:00
Benjamin Walsh ee659ae1a1 build: add _ASMLANGUAGE to all asm files
This avoids asm files from having to explicitly define the _ASMLANGUAGE
symbol themselves.

Change-Id: I71f5a169f75d7443a58a0365a41c55b20dae3029
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-01-24 13:34:51 +00:00
Kumar Gala 043b006c0f clock_control: nrf5_power: Use CMSIS NVIC APIs directly
Convert driver to use the CMSIS NVIC APIs rather than the internal ones
so we can remove them in the future.

Change-Id: I7bf3024ea4baf61f1e42bbbd5e4b0abfc6c04e6b
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:55 -06:00
Kumar Gala 8c75d79a15 timer: nrf_rtc: Use CMSIS NVIC APIs directly
Convert driver to use the CMSIS NVIC APIs rather than the internal ones
so we can remove them in the future.

Change-Id: I31c2f37bc0aa35668a441f4ef2821b768dd7b817
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:55 -06:00
Kumar Gala 7f5dc1ab30 arm: cmsis: Convert systick to CMSIS
Remove use of __scs structures and defines in place of CMSIS defined
ones.  Also, use __ISB() instead of inline asm.

Jira: ZEP-1568

Change-Id: I8798206a12680f6c50105c7c28112632ac9dde50
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:55 -06:00
Maureen Helm 8769cd585e spi: k64: Remove the k64 spi driver
Now that we have a more generic mcux spi driver that can be used across
multiple Kinetis SoCs, remove the specific k64 spi driver.

Jira: ZEP-1374
Change-Id: Ifc324374f305837f5e3d2cfd7ad30d3608865b5b
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-23 15:15:54 -06:00
Maureen Helm d138a4fad1 spi: Introduce new mcux shim driver
Adds a shim layer around the mcux dspi driver to adapt it to the Zephyr
spi interface. Unlike the existing k64 spi driver, this driver can be
used for other Kinetis SoCs that contain the dspi module.

Jira: ZEP-1374
Change-Id: I9417c1513565dfcc47ccda098492f60e840f4f84
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-23 15:15:54 -06:00
Maureen Helm bd562921e8 spi: Add shared default configs
Adds default configurations for baud rate, transfer word size, clock
polarity and phase. These default configurations can be shared across
multiple spi drivers.

Change-Id: I221b402c075003014991b38f6342a89e55c3bec9
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-23 15:15:54 -06:00
Vincenzo Frascino a93b88789b counter: cmsdk: Add Dualtimer as a Timer
This patch adds Dualtimer support to be used as a Timer.

Jira: ZEP-1300
Change-Id: If13143c8a8bdb07210daca66deca44710a18406f
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2017-01-23 15:15:54 -06:00
Vincenzo Frascino b1e02a594a counter: cmsdk: Add DualTimer as Counter
This patch adds Dualtimer to be used as a counter.

Jira: ZEP-1300
Change-Id: Ic4a2d89ec7fc0c0c2a0bc7f6d32d97637049faaf
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2017-01-23 15:15:54 -06:00
Vincenzo Frascino b11242d11f counter: cmsdk: Add Timer 0 and 1 as Timers
This patch adds Timer 0 and 1 to be used as timers.

Jira: ZEP-1300
Change-Id: I57112a8ed6f5daa22345e8807e9ebe87bb09e782
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2017-01-23 15:15:54 -06:00
Vincenzo Frascino d36543828b counter: cmsdk: Add clock control to TMR Counters.
This patch adds clock control to the counters based on Timer 0 and 1.

Jira: ZEP-1300
Change-Id: I14499a833fe9720496ab7905bc1466e9b03bb316
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2017-01-23 15:15:54 -06:00
Vincenzo Frascino 06f6d3837b counter: cmsdk: Add common interface
This patch adds a common interface for timers and counters based on
CMSDK APB timers.

Jira: ZEP-1300
Change-Id: I1f89f674d31410f19b651cd904c79f8d173a5357
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2017-01-23 15:15:53 -06:00
Maureen Helm 82eaa7cd5b gpio: serial: Fix NXP copyright
The NXP copyright should not have 'Semiconductors, Inc' in it.

Change-Id: I6e290146d49bf22d1d40b7fa764bb53b6b122303
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-23 15:15:53 -06:00
Michael Scott fe99cfe630 drivers: gpio: stm32: fix CONFIG_SOC_SERIES_STM32F4X build break
The commit c90e4d063be0ff5f47df45ca8500eff8518c5d25 changed
line 216 in drivers/gpio/gpio_stm32.c:
-elif CONFIG_SOC_SERIES_STM32F4X
+#elif /* CONFIG_SOC_SERIES_STM32F4X */

This causes the following compiler error:
zephyr/drivers/gpio/gpio_stm32.c:218:39: error: #elif with no expression
 #elif /* CONFIG_SOC_SERIES_STM32F4X */
                                       ^

Change-Id: Ie8b124931e333aa7860e6db22f5c259670e29833
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-23 15:15:53 -06:00
Maureen Helm 294fdab7bd serial: k64: Remove the uart_k20 driver
Now that we have a more generic mcux serial driver, remove the uart_k20
driver.

Jira: ZEP-719
Change-Id: I51a3237454140feabbfe18ac2c8ee451e572c7be
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-23 15:15:53 -06:00
Maureen Helm 38f812828e serial: Introduce new mcux shim driver
Adds a shim layer around the mcux uart driver to adapt it to the Zephyr
serial interface. Unlike the existing (and confusingly-named) uart_k20
driver, this driver can be used for k64 and other Kinetis SoCs.

Implements polling and interrupt-driven serial interface functions that
are logically equivalent to the uart_k20 driver. Adds an extra instance,
irq_tx_empty(), and err_check() that aren't implemented in the uart_k20
driver.

Jira: ZEP-719
Change-Id: Iab99542e7ec921ef4f361437768113fee01e5fe8
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-23 15:15:53 -06:00
Erwan Gouriou 8890b73b6e license: Replace Apache boilerplate with SPDX tag
Apply JIRA: ZEP-1457 to STM32F3X family porting patchset.

Change-Id: I352267a47847143e557a4016de12bb9a14a20067
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:53 -06:00
Adam Podogrocki a0dcfcce97 pinmux/stm32: default pin assignment for STM32373C-EVAL board
Change-Id: Id4b04749e1d707d12aa78cabd8d103701b6d55b6
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:53 -06:00
Adam Podogrocki 7d6c139082 pinmux/stm32: default pin assignment for NUCLEO-F334R8 board
Change-Id: Ib70471ceb2e4444d5826a5a17cbfc42161df78d2
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:53 -06:00
Adam Podogrocki 2ce996695a pinmux/stm32: default pin assignment for STM3210C-EVAL board
Change-Id: I87c3806b2fad649c67e8d66981ff6a99168fda72
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:53 -06:00
Kumar Gala 05f717e71b uart/stm32: add STM32F3X support for uart
Change-Id: I9796c6a2841c972eeab15894a6d7f38ae93606d1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:53 -06:00
Adam Podogrocki 726d11a5a2 pinmux/stm32: extend pinmux driver functionality to support STM32F3X series MCUs
Change-Id: Ifc4c93e03b6593f1b6c7e664fdf719f9344fe1ee
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
Adam Podogrocki f23492a059 gpio/stm32: provide GPIO driver implementation for STM32F3X family
Implementation includes adding some defines in the pinmux,
adjusting gpio driver to specific defines for STM32F3X family,
adding specific functionality in the F3X SoC definition.

Change-Id: I465c66eb93e7afb43166c4585c852e284b0d6e67
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
Adam Podogrocki 61cc74c425 flash/stm32: flash driver for STM32F3x series microcontrollers
Change-Id: I0b41a50507a09a513a67d13374323d831a0ec86a
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
Adam Podogrocki c80023fca3 exti/stm32: add support for F334 & F373 MCUs
Change-Id: Ide3a3842077e6138ec9e6ce87bacf744632413bc
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
Adam Podogrocki c514f671c7 clock/stm32: add STM32F3X reset and clock control
Change-Id: Ie5f3ffec0b3aaf15f9d9f8063d2bab6be5aebb6e
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
Anas Nashif aaf7f7fb91 Merge "Merge net branch into master" 2017-01-20 15:23:09 +00:00
Bogdan Davidoaia 4fadbbeebd sensor: fxos8700: fix missing dependency in Kconfig
FXOS8700_THREAD_PRIORITY and FXOS8700_THREAD_STACK_SIZE need to also
depend on FXOS8700_TRIGGER, else they will not show in the fxos8700
menu entry when running "make menuconfig".

Change-Id: I8f59125157f046592f3c92dcf2a92bd0e407cd6a
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-20 14:40:40 +00:00
Leandro Pereira 3587b97845 net: slip: Do not remove fragments when sending data
The rationale for removing fragments while sending them is to free the
memory they're using as soon as possible.  This worked fine because
most protocols implemented initially did not require any
retransmission, so the upper layers were never holding an extra
reference to the buffer (& their fragments).

This is not the case anymore, as the TCP layer holds a reference to
a buffer (& fragments) while confirmation from the peer has not been
received, allowing retransmission.

With this change, the fragments of a buffer are not removed when being
sent by the SLIP layer; however, the buffer is still deferenced when the
transmission is complete.  If nothing else holds a reference, all the
fragments are returned to their respective pools, like before.

Change-Id: I74966d72f6970b66f526ea0b765101077c843de2
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-01-20 16:23:17 +02:00
Flavio Santes 1c21029237 drivers/ethernet: Update default GPIO pin for the ENC28J60 module
All sample applicatons in Zephyr, using the ENC28J60 driver, set
the ETH_ENC28J60_0_GPIO_PIN Kconfig variable to 19.
However, in the Kconfig.enc28j60 file this variable is set to 24.
That default value, 24, was used only during the first iterations
of this driver and never used again.

In this patch, we set the Kconfig variable to 19 and simplify
project configuration files by removing one line.

Change-Id: I3d5fd9da04a3f10845d2a409de56f5b9c235e995
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-01-20 16:23:17 +02:00
Kuo-Lang Tseng faecff7e88 drivers: QMSI GPIO: simplify driver reentrancy code using IS_ENABLED macro
This is one of the series of patches that simplifies the driver
code by using the IS_ENABLED macro. This removes the need of the
const variable and the three wrapper functions on semaphore APIs.

Jira: ZEP-1251

Change-Id: I5102e8674663ddbfc65220de72c8b778a9ec726c
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-01-20 01:46:08 +00:00
Kuo-Lang Tseng dad4127761 drivers: QMSI WDT: simplify driver reentrancy code using IS_ENABLED macro
This is one of the series of patches that simplifies the driver
code by using the IS_ENABLED macro. This removes the need of the
const variable and the three wrapper functions on semaphore APIs.

Jira: ZEP-1251

Change-Id: I2ea0b2d04252d6b28e7d5ca528480234545e6eed
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-01-19 16:48:42 -08:00
Johan Hedberg 916837c22c Bluetooth: SPI: Replace Apache boilerplate with SPDX tag
There was a recent change to the license boilerplate of the entire
source tree, however as this spi.c was just recently added it missed
the change.

Change-Id: Icc95084a4b051266beaf1796c31d9aec9da538d0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-19 08:04:16 +02:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Anas Nashif 811b3710ba Merge "Merge bluetooth branch into master" 2017-01-19 03:00:59 +00:00
Baohong Liu 9888bc8b9c drivers: i2c: remove an unnecessary condition check
Remove an unnecessary condition check in Kconfig.
All the config options already depend on I2C.

Change-Id: Ia8876442652df9f105e862d8c2db394699c81f63
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-01-18 17:13:10 -08:00
Johan Hedberg eccf03265f Merge bluetooth branch into master
- New SPI HCI driver for ST BlueNRG modules
 - More memory optimizations through TX buffer pool consolidation
 - Refactoring to take advantage of new IS_ENABLED() macro
 - Fixes to LE L2CAP Credit-based Flow Control
 - Various smaller fixes & enhancements here and there

----------------------------------------------------------------
Arkadiusz Lichwa (2):
      Bluetooth: UUID: Fix format specifier in 128-UUID
      Bluetooth: ATT: Fix redundant sys_slist call

Arun Jagadish (1):
      Bluetooth: AVDTP: Added params to AVDTP Request structure

Carles Cufi (1):
      bluetooth: hci_core: Fix conn params validity check

Jaganath Kanakkassery (1):
      Bluetooth: RFCOMM: Implement Aggregate Flow Control

Johan Hedberg (21):
      Bluetooth: Consolidate most outgoing ACL TX buffers into a single pool
      Bluetooth: Use the controller bt_rand() whenever possible
      Bluetooth: Controller: Rename hci_le_rand to bt_rand
      Bluetooth: hci_uart: Remove redundant idle & ISR stack size values
      Bluetooth: Remove unused bt_hci_driver_unregister() API
      Bluetooth: Add missing documentation to HCI driver APIs
      Bluetooth: GATT: Fix missing connection address comparison
      Bluetooth: ATT: Add new error code from CSSv7
      Bluetooth: Prefer struct bt_le_conn_param over individual values
      Bluetooth: Add documentation for connection callbacks
      Bluetooth: Remove ACL details from BT_BUF_RX_SIZE
      Bluetooth: L2CAP: Remove RECV_RESERVE from BT_L2CAP_RX_MTU
      Bluetooth: Introduce a new connection parameter request callback
      Bluetooth: Take advantage of IS_ENABLED macro for BT_DBG
      Bluetooth: Add __printf_like annotation for bt_log
      Bluetooth: drivers/nble: Remove bogus BT_DBG manipulation
      Bluetooth: hci_core: Take advantage of IS_ENABLED whenever possible
      Bluetooth: conn: Take advantage of IS_ENABLED whenever possible
      Bluetooth: L2CAP: Take advantage of IS_ENABLED whenever possible
      Bluetooth: SMP: Take advantage of IS_ENABLED whenever possible
      Bluetooth: Don't select TinyCrypt RNG for combined builds

Lee Jones (5):
      pinmux/stm32l4: Add support for STM32L SPI1 and SPI3
      pinmux/nucleo_l476rg: Define pinmuxing for SPI1 and SPI3
      Bluetooth: Add HCI SPI driver
      Bluetooth: samples/beacon: Print message at start of sample
      Bluetooth: Kconfig: Specify stack size for Bluetooth SPI

Luiz Augusto von Dentz (4):
      Bluetooth: L2CAP: Fix using CONFIG_BLUETOOTH_RX_BUF_LEN as MTU
      Bluetooth: IPSP: Reuse buffer fragments instead of copying
      Bluetooth: L2CAP: Make sure state is correctly updated
      Bluetooth: L2CAP: Fix always using RX_BUF_COUNT as initial credits

Sathish Narasimman (1):
      Bluetooth: AT: Rename enum at_cmd_type elements

 drivers/bluetooth/hci/Kconfig                   |  81 +++
 drivers/bluetooth/hci/Makefile                  |   1 +
 drivers/bluetooth/hci/h4.c                      |   8 +-
 drivers/bluetooth/hci/h5.c                      |   8 +-
 drivers/bluetooth/hci/spi.c                     | 351 ++++++++++++
 drivers/bluetooth/nble/conn.c                   |   8 +-
 drivers/bluetooth/nble/gap.c                    |  13 +-
 drivers/bluetooth/nble/gatt.c                   |   8 +-
 drivers/bluetooth/nble/rpc_deserialize.c        |  27 +-
 drivers/bluetooth/nble/rpc_serialize.c          |   5 -
 drivers/bluetooth/nble/smp.c                    |   3 +-
 drivers/bluetooth/nble/uart.c                   |   6 +-
 drivers/bluetooth/nrf51_pm.c                    |   1 +
 .../pinmux/stm32/pinmux_board_nucleo_l476rg.c   |  12 +
 drivers/pinmux/stm32/pinmux_stm32l4x.h          |  10 +
 include/bluetooth/att.h                         |   1 +
 include/bluetooth/buf.h                         |   1 -
 include/bluetooth/conn.h                        |  81 ++-
 include/bluetooth/l2cap.h                       |   2 +
 include/bluetooth/log.h                         |  40 +-
 include/drivers/bluetooth/hci_driver.h          | 106 +++-
 samples/bluetooth/beacon/src/main.c             |   2 +
 samples/bluetooth/hci_uart/nrf5.conf            |   2 -
 samples/bluetooth/ipsp/src/main.c               |  35 +-
 subsys/bluetooth/controller/hal/nrf5/rand.c     |   2 +-
 subsys/bluetooth/controller/hal/rand.h          |   2 +-
 subsys/bluetooth/controller/hci/hci.c           |   4 +-
 subsys/bluetooth/controller/hci/hci_driver.c    |  18 +-
 subsys/bluetooth/controller/hci/hci_internal.h  |   1 -
 subsys/bluetooth/controller/ll/ctrl.c           |   1 +
 subsys/bluetooth/host/Kconfig                   |  63 ++-
 subsys/bluetooth/host/a2dp.c                    |   7 +-
 subsys/bluetooth/host/at.c                      |  38 +-
 subsys/bluetooth/host/at.h                      |  10 +-
 subsys/bluetooth/host/att.c                     |  65 +--
 subsys/bluetooth/host/att_internal.h            |   6 +
 subsys/bluetooth/host/avdtp.c                   |  24 +-
 subsys/bluetooth/host/avdtp_internal.h          |  10 +-
 subsys/bluetooth/host/conn.c                    | 157 +++---
 subsys/bluetooth/host/conn_internal.h           |   4 +-
 subsys/bluetooth/host/gatt.c                    |  12 +-
 subsys/bluetooth/host/hci_core.c                | 504 +++++++++---------
 subsys/bluetooth/host/hci_core.h                |   5 +-
 subsys/bluetooth/host/hci_ecc.c                 |  11 +-
 subsys/bluetooth/host/hci_raw.c                 |   8 +-
 subsys/bluetooth/host/hfp_hf.c                  |   6 +-
 subsys/bluetooth/host/keys.c                    |   6 +-
 subsys/bluetooth/host/keys.h                    |   4 -
 subsys/bluetooth/host/keys_br.c                 |   6 +-
 subsys/bluetooth/host/l2cap.c                   | 108 ++--
 subsys/bluetooth/host/l2cap_br.c                |  32 +-
 subsys/bluetooth/host/l2cap_internal.h          |   8 +-
 subsys/bluetooth/host/log.c                     |   2 -
 subsys/bluetooth/host/monitor.c                 |   1 -
 subsys/bluetooth/host/rfcomm.c                  | 148 ++++-
 subsys/bluetooth/host/rfcomm_internal.h         |  15 +
 subsys/bluetooth/host/sdp.c                     |   6 +-
 subsys/bluetooth/host/smp.c                     | 211 ++++----
 subsys/bluetooth/host/smp_null.c                |   7 +-
 subsys/bluetooth/host/storage.c                 |   1 +
 subsys/bluetooth/host/uuid.c                    |   2 +-
 tests/bluetooth/shell/arduino_101.conf          |   2 +-
 tests/bluetooth/shell/prj.conf                  |   2 +-
 63 files changed, 1479 insertions(+), 852 deletions(-)
 create mode 100644 drivers/bluetooth/hci/spi.c

Change-Id: Ic11028e1f02636a48d95cbe03735af37cea94e25
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-18 19:09:51 +02:00
Lee Jones 7890290e81 Bluetooth: Add HCI SPI driver
This driver acts as a pass-through, taking raw HCI data, converting
it to SPI comms and vice versa.  It works in the same way as the
existing H:4 and H:5 drivers, only it uses SPI instead of UART.

In this first release, the only BLE board which has been tested is
the X-NUCLEO-IDB05A1:

  http://www.st.com/en/ecosystems/x-nucleo-idb05a1.html

Although the current supported SPI format works like the one below,
it should be trivial to adapt it to support other chips with a
different format.

SANITY CHECK = 0x02
SPI WRITE    = 0x0A
SPI READ     = 0x0B

Tx Format:

   [HOST] {SPI WRITE}     0x00          0x00  0x00  0x00  {HCI MESSAGE ...}
   [CHIP] {SANITY CHECK}  {FLASH SIZE}  0x00  0x00  0x00  {0xFF * MESSAGE LEN}

Rx Format:

   {IRQ LINE GOES HIGH}

   [HOST] {SPI READ}  0x00          0x00  0x00             0x00  {0xFF * BYTES TO READ}
   [CHIP] 0x02        {FLASH SIZE}  0x00  {BYTES TO READ}  0x00  {HCI MESSAGE ...}

Change-Id: I4a00711c922d9ea02c5e2afb0d16715e413b1ed5
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-01-18 12:24:17 +00:00
Lee Jones 84050f647b pinmux/nucleo_l476rg: Define pinmuxing for SPI1 and SPI3
Change-Id: I78978637483a630c92ca75d9ddf190f460a1fe5a
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-01-18 11:12:24 +00:00
Lee Jones 1ac8d01ccd pinmux/stm32l4: Add support for STM32L SPI1 and SPI3
Change-Id: I7d28f6ea2322fdaf17cde205d4550cfad38ea967
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-01-18 11:08:14 +00:00
Johan Hedberg 4ce96e1bc3 Bluetooth: drivers/nble: Remove bogus BT_DBG manipulation
This file doesn't even include <bluetooth/log.h> so any tricks on
BT_DBG are completely pointless (and wrong after the recent update to
the debug logging API).

Change-Id: I1b2b7942a11a4f7229dc35aa2701b3180dc35a28
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-18 11:04:58 +02:00
Johan Hedberg 645f867444 Bluetooth: Take advantage of IS_ENABLED macro for BT_DBG
The new IS_ENABLED macro allows exposing conditionally enabled code
always to the compiler, even though it may not ultimately end up being
built. This is in particular useful for letting the compiler catch any
logging format string errors. Introduce a new BT_DBG_ENABLED macro
that c-files need to define before including <bluetooth/log.h> in
order to choose whether BT_DBG() logs are enabled or not.

When no Bluetooth logs are enabled the patch also modifies the log
macros to have the format strings checked with the help of the
__printf_like annotation and empty static inline functions.

Change-Id: Ie6bc8e10727b5b306f3ed0f94089a07a22583d9b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-18 08:28:06 +02:00
Kuo-Lang Tseng c0a546ed33 drivers: QMSI AON counter: Simplify driver reentrancy code
With the use of the IS_ENABLED macro
(https://gerrit.zephyrproject.org/r/#/c/9882), the driver
reentrancy code is simplified:

The original const variable which used to serve the purpose of
making the build to compile out the reentrancy code when the
reentrancy configuration flag is not enabled is no longer
needed as the use of the IS_ENABLED macro achieves the same result.
Also the original 3 wrapper functions around semaphores API are
not necessary; instead, just use the semaphore API directly.

Jira: ZEP-1251

Change-Id: I23552b77d19044dc94de443018759cb3ec10a52b
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-01-17 19:04:46 +00:00
Anas Nashif 6b65dcefd2 legacy: Move TICKS_UNLIMITED -> K_FOREVER
Change-Id: Ic1e73959a3444bc6e015e341899c75b1ef850189
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 19:03:35 +00:00
Anas Nashif b52a5450b0 legacy: use k_cycle_get_32 instead of legacy sys_cycle_get_32
Jira: ZEP-1585
Change-Id: Idac4685625f191771b90ce78234d97f5143413f0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 19:03:34 +00:00
Bogdan Davidoaia 30162aedf1 sensor: remove sensor value type
Remove the type field from the sensor value structure. All values will
have the type previously defined by SENSOR_VALUE_TYPE_INT_PLUS_MICRO.

This simplifies the interface, as apps will know what value type to
expect. Apps that prefer to use double values can optain them using the
sensor_value_to_double function.

Change-Id: I3588d74258030eb16c3f89d8eead13cca4606b18
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-15 01:09:33 +00:00
Anas Nashif 662a2d6476 Merge "Merge net branch into master" 2017-01-14 13:11:34 +00:00
Jean-Paul Etienne 67dcd1b0b0 gpio: added support for the pulpino GPIO controller driver
tested with blinky, button and disco apps

Change-Id: I4b520d4f3e42c97e4a723747ce4a6c67ca9f1d18
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:57:03 +00:00
Jean-Paul Etienne 7cf3688740 serial: added support for the riscv-qemu UART driver
riscv-qemu UART:
1) comprises only one register that is used to send or
   receive characters in a polling fashion.
2) does not have a FIFO and is not interrupt-driven.

Change-Id: I9408f1776eba4cec4aa203a5da759ec04bcddf1f
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:56:24 +00:00
Jean-Paul Etienne 23cef9e655 timer: added support for the riscv-qemu timer driver
The riscv-qemu timer driver does not implement
TICKLESS_IDLE

Change-Id: I3eeb5abb05b3f16b55ab9343c2045295b3010cfd
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:56:09 +00:00
Jean-Paul Etienne ec76a4bb63 timer: added timer driver for the pulpino SOC
The pulpino_timer driver does not implement TICKLESS_IDLE
for the time being.

Change-Id: I0cce8c8a7e203d551a924863462e6c86af4c98ff
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:55:50 +00:00
Johann Fischer ce189f84a9 ieee802154: conf: add common log level
Add common log level for all IEEE802154 drivers.

Change-Id: If92c96b14e630d4482aadf9cacb25662d6663399
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-01-13 10:29:00 +01:00
Benjamin Walsh 3c39e55ab1 arc: fix unaligned variables resulting in unaligned k_cpu_sleep_mode
Force-align all variables defined via asm .word to ensure 4-byte
alignment.

The straddled_tick_on_idle_enter variable was a bool, which resolved in
an one-byte quantity. Changing it to a 32-bit integer. It would have
occupied 4 bytes anyway with alignment.

Fixes ZEP-1549.

Change-Id: If5e0aa1a75dbc73d896b44616f059d221fe191c6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2017-01-13 01:36:08 +00:00
Maureen Helm 4973787c10 pinmux: Remove the k64 pinmux driver
The k64 pinmux driver was deprecated when the more generic mcux pinmux
driver was added, but it can actually just be removed because it is not
a public interface. Applications should be using the public pinmux API,
not the private k64 pinmux API. There was one case in the net samples
that used the private API which was cleaned up in a previous patch.

Change-Id: I49a6397baa57973930cb63bd2a9883b14f7ddafd
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:28 -06:00
Maureen Helm 7682a0d7ca gpio: Remove the k64 gpio driver
Now that we have a more generic mcux gpio driver that can be used across
multiple Kinetis SoCs, remove the specific k64 gpio driver.

Jira: ZEP-1394
Change-Id: I177f96a75e441b70c523e74e99f1b7a54eac6b0e
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:27 -06:00
Maureen Helm d71f246855 gpio: Introduce new mcux gpio driver
Adds a new mcux gpio driver that can be used for k64 and other Kinetis
SoCs. This driver uses mcux CMSIS register accesses to the GPIO and PORT
modules. Some of the logic from the k64 gpio driver was reused and
refactored (mainly flag parsing and callback handling).

Jira: ZEP-1394
Change-Id: If5e9390861c181ec555dce6569b14debb729526a
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:27 -06:00
Maureen Helm d2c9446163 pinmux: Init mcux pinmux driver in PRE_KERNEL_1
Changes the init level for the mcux pinmux driver from POST_KERNEL to
PRE_KERNEL_1. This will allow moving the uart console pins from the k64
soc init to the board pinmux tables.

Change-Id: I6d3377c9a689c12711c84387f74843ca9488df52
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:27 -06:00
Adam Podogrocki 72782f542c clock/stm32: add STM32F107 reset and clock control
Change-Id: If2280187c866c130212ea22c3d406501f37133b2
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-12 09:46:27 -06:00
Maureen Helm 4183dae89b pinmux: Rename ksdk to mcux
Renames the ksdk pinmux driver to mcux.

Change-Id: I7a519318b5b580c47b6f6652a2ae763067d85033
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:27 -06:00
Maureen Helm e17adf377b flash: Rename ksdk to mcux
Renames the ksdk soc flash driver to mcux.

Change-Id: I835e36f25d8bc3e3aa6286718452528174378907
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:26 -06:00
Maureen Helm aa995f8d2f random: Rename ksdk to mcux
Renames the ksdk random generator shim driver to mcux.

Change-Id: I8bc376937fed3024c809782139a0a72c7332f89a
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:26 -06:00
Maureen Helm b22bc6e69b i2c: Rename ksdk to mcux
Renames the ksdk i2c shim driver to mcux.

Change-Id: I1bcae2fa30cb698af32d6abc609d77dee42c608d
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:26 -06:00
Maureen Helm 40f5de5a56 ethernet: Rename ksdk to mcux
Renames the ksdk ethernet shim driver to mcux.

Change-Id: Ief03eabe4ce39be0d0896543c1cb660ff380b439
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:26 -06:00
Maureen Helm 9f61bfce9a pinmux: Remove stale ksdk pinmux dev references
The ksdk pinmux dev driver was previously merged into the regular ksdk
pinmux driver, and the config PINMUX_DEV_KSDK was removed. Two
references were inadvertantly left behind, so remove them now.

Change-Id: I77394be5459d55a9f16e7bd2b3c9d688c4605b4f
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:25 -06:00
Maureen Helm acca033468 pinmux: Merge ksdk pinmux dev into regular ksdk pinmux driver
Merges the ksdk pinmux dev driver into the regular ksdk pinmux driver,
which now exposes the public pinmux API. Removes the private ksdk pinmux
API and converts the frdm_k64f and hexiwear_k64 boards to use the public
pinmux API.

Jira: ZEP-958, ZEP-1432
Change-Id: Ie5f60b604133093050b9c596050cad776d7b7cb3
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:25 -06:00
Kumar Gala b7386c3a26 arm: nordic_nrf5: Cleanup Kconfig dependencies for timer and clocks
On the nRF5x platforms we need always need the NRF_RTC_TIMER and it
depends on the CLOCK_CONTROL_NRF5.  So enable all of these always.

Fixes issues if one tries to build nRF5x platforms w/o CONFIG_BLUETOOTH.

Change-Id: I0f9af785e785f37ec289a935ddf70ee6dec08cd4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-09 20:55:10 +00:00
Anas Nashif f6e039062a kernel: remove dependency on CONFIG_NANO_TIMERS/TIMEOUTS
Remove legacy option and use SYS_CLOCK_EXISTS where appropriate.

Change-Id: I3d524ea2776e638683f0196c0cc342359d5d810f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-08 18:09:52 +00:00
Anas Nashif e161d08756 trivial: fix typo
Change-Id: Id6f486bf151c3fb1065e9dcfae445ec120e83a62
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-08 16:17:00 +00:00
Baohong Liu da17225d63 drivers: aio: remove aio disabling before invoking callback
Remove aio disabling code before calling callback. If aio is
disabled before callback is invoked, calling pending
interrupt check API in the callback will get negative result.
If user wants to disable the aio, it can do this in callback
instead of this being done blindly before callback.

Jira: ZEP-1437

Change-Id: I42ebe4584af6396ac2360152f9b0e2c389c44145
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-01-07 14:14:29 +00:00
Qiu Peiyang ed0e5e6fd5 driver: gpio: remove nano_timer code
drivers/gpio/gpio_pcal9535a.c defines a nano_timer,
but never uses it. So delete it.
gpio_sch.c uses a k_timer, but gpio_sch.h defines a
nano_timer. So change the variable poll_timer to
type k_timer.

Jira: ZEP-1525

Change-Id: I884e4703c1ace61da5be7d9c63e58e7c3bce7f68
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-01-07 12:16:06 +00:00
Anas Nashif 89e64ee446 Merge "Merge bluetooth branch into master" 2017-01-05 21:55:54 +00:00
Marcus Shawcroft 98f3f3b1a5 sensor/bmc150: Fix layout.
Change-Id: Ibbf5f74b6e3298586f40e35c3cb9a2414655db41
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-05 16:19:29 +00:00
Marcus Shawcroft 8386d2f3fa sensor/bmc150: Drop unncessary external definition.
Change-Id: Ic1e85685ca50a7f2568f327a0bf211c1ef4740e3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-05 16:19:28 +00:00
Marcus Shawcroft cc7f0e05b4 sensor/nrf5_temp: Drop unncessary attribute set callback.
The sensor_attr_set() wrapper deals with drivers that do not support
the attribute set API, there is no need to provide a per driver
implementation that only return -ENOTSUP.

Change-Id: I1568ab018988fc560bd89ab96f2f2256ddd5b7e1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-05 16:19:28 +00:00
Jean-Paul Etienne cfa43f5bda serial: enable 64-bytes FIFO for UART 16750 in uart_ns16550 driver
UART 16750 is basically a UART 16550 with a 64-bytes FIFO.
The 64-bytes FIFO can be enabled via register FCR.

Account for it in the uart_ns16550 driver whenever the
CONFIG_UART_NS16750 variable is set.

Change-Id: I2342b28a41d03c96410bbfbe57e4b5a4e335731d
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-05 16:05:20 +00:00
Carles Cufi 0e650d4eaf drivers: rtt: Lock interrupts around RTT Write
Since RTTWriteNoLock is not thread-safe or preemptable, it is necessary
to lock interrupts around the calls to it.

Change-id: I38b7e37a0f46e77bf82c1e07d549414393e84a51
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-01-05 13:32:11 +01:00
Johan Hedberg d64f47d956 Bluetooth: Create separate bt_recv_prio() API
Since callers of bt_recv() have so far anyway been required to know in
which context to call it (based on e.g. bt_hci_evt_is_prio) it's
cleaner to have two separate APIs: bt_recv and bt_recv_prio.

Change-Id: Icd0d9aed9c51ffd2def31432c4ffcc16a9f13ccd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:17 +02:00
Johan Hedberg 3341d7d2b5 Bluetooth: h4: Convert TX path to be interrupt based
Use interrupt based transmission instead of polling.

Change-Id: Iebfd67372044d3e6de9bdbdd6f0c9c6d01d46cb9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:17 +02:00
Johan Hedberg 37aa1a1f8b Bluetooth: h4: Use k_fifo instead of k_sem
So far the use of k_sem meant that there was no major benefit of
having more than 2 or 3 RX buffers since there was no queuing
mechanism. Instead of using k_sem, introduce a k_fifo and use that to
queue up incoming buffers. This way the RX buffer count can be
increased with measurable effects on throughput.

Change-Id: I8122b233aeee7c8e145de3fff5f10bcfe348efaa
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:17 +02:00
Johan Hedberg 3fb654ecd1 Bluetooth: drivers: Use bt_buf_get_rx() in h5.c
The H:5 HCI driver doesn't need the type-specific bt_buf allocation
helpers.

Change-Id: Iccb9803f32f3143f1cdf972d9229124816a99aa6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:17 +02:00
Johan Hedberg 95049fb99b Bluetooth: Convert H:4 HCI driver to RECV_IS_RX_THREAD
Completely redesign the H:4 driver to utilize its own thread and
select the new RECV_IS_RX_THREAD Kconfig option.

Jira: ZEP-1483

Change-Id: I0ca0661b66d564e5edc1b8505706d6bb76632e79
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:17 +02:00
Johan Hedberg 6f429a38d8 Bluetooth: Kconfig Remove HOST_BUFFERS option
This option has not been used so far and will only contribute
unnecessary complexity in subsequent patches that introduce a concept
of combined RX buffers.

Change-Id: I53e0ce5155eebc352b84ba41b30ecb9d9958699f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:16 +02:00
Johan Hedberg 63f71adc5f Bluetooth: Take advantage of new net_buf_add_mem() API
This helps simplify code that was previously combining net_buf_add()
with memcpy().

Change-Id: If44cf9cd651aba5e544e36567869f147468663eb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:16 +02:00
Anas Nashif 7297f5db88 shell: move shell to its own subsystem
This moves the shell component into its own subsys and groups all
related files and options into a single place.

Additionally, one Kconfig option will now be required to enable the
shell:

 CONFIG_CONSOLE_SHELL=y

The header files was also moved to include/shell/shell.h and can be now
referenced with

 #include <shell/shell.h>

instead of

 #include <misc/shell.h>

Updated documentation as well.

Change-Id: Iffbba4acfa05408055e9fd28dffa213451351f94
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 19:35:11 +00:00
Anas Nashif c1347b4730 kernel: replace all remaining nanokernel occurances
replace include <nanokernel.h> with <kernel.h> everywhere and also fix
any remaining mentions of nanokernel.

Keep the legacy samples/tests as is.

Change-Id: Iac48447bd191e83f21a719c69dc26233216d08dc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 14:34:43 -05:00
Marcus Shawcroft 4127775bcf random: Introduce random device API.
Introduce random device API analgous to other device driver classes in
Zephyr.  Modify the the KSDK random driver to implement the API.

We retain the sys_rand32_get() interface for now on the assumption it
will eventually relocate to or be otherwise replaced by an entropy
management system.

The existing TEST_RANDOM_GENERATOR related drivers that do not
generate entropy are not modified to expose this driver API since they
cannot generate entropy.

Change-Id: I60b2d5afddf242e802a1d9014c99579870fb7472
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-24 16:40:11 +00:00
Sergio Rodriguez 4b288999b2 drivers: gpio_atmel: Fix erronous if statement
The GPIO_INT_LEVEL value is zero so the mask assignement
is never executed. Using the bit complement GPIO_INT_EDGE
the proper mask is assigned

This issue was reported by Coverity

Coverity-CID: 151966

Change-Id: Iacfeb6466388023bd6123ba86280aa9ca15f34e4
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-12-24 13:52:51 +00:00
Johan Hedberg f3c632bf44 Bluetooth: Add timeout to event & ACL buffer allocation functions
Not all users are in an ISR context where we can't block, so give the
callers the freedom to choose if they want to block or not.

Jira: ZEP-1481

Change-Id: I19bd7e2df94c4eeb60886a17a78f872bd7bea887
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-24 08:42:15 +02:00
Qiu Peiyang b549e0fbca spi_qmsi_ss: add device_busy_set() to avoid re-enter deep sleep
When CONFIG_SYS_POWER_DEEP_SLEEP is enabled, spi_qmsi_ss will
keep entering deep sleep because it needs to wait until the
current transfer completes, which blocks the current thread.
The system keeps entering deep sleep again and again and the
transfer will never complete.

Add device_busy_set() to spi_qmsi_ss driver to indicate that
the device is busy and block the system from entering deep
sleep during transaction.

Jira: ZEP-1488

Change-Id: I5a4456933249def93eaa529b30b99d730af74482
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-12-23 16:49:23 +00:00
Qiu Peiyang e4ad31a231 i2c_qmsi_ss: add device_busy_set() to avoid re-enter deep sleep
When CONFIG_SYS_POWER_DEEP_SLEEP is enabled, i2c_qmsi_ss will
keep entering deep sleep because it needs to wait until the
current transfer completes, which blocks the current thread.
The system keeps entering deep sleep again and again and the
transfer will never complete.

Add device_busy_set() to i2c_qmsi_ss driver to indicate that
the device is busy and block the system from entering deep
sleep during transaction.

Jira: ZEP-1487

Change-Id: Ia681d242349bce5a9867e54df4e65dba09005930
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-12-23 16:49:23 +00:00
Baohong Liu db09c2905b drivers: i2c_shim: grant arc the access to i2c on I/O fabric
Enable arc to access the i2c controller on I/O fabric.

There are two i2c controllers on quark se SoC. One is attached
to the I/O fabric and the other one is in the sensor system.
X86 cpu is only able to access the i2c controller on the I/O
fabric and the access is supported by existing code. HW allows
arc to access both controllers. But, the existing code only
gives arc access to the controller in the sensor sub-system.
Let's grant arc the access to the controller on I/O fabric as
well by the following changes.

1. Add i2c_qmsi.c into arc compilation.
2. Use the already defined macros to choose interrupt numbers
   and do interrupt unmasking automatically based on the
   compilation targets.
3. Add new symbols in Kconfig including driver names for both
   controllers

Jira: ZEP-1189

Change-Id: I317da6038c50e0c8bd16f446182c1f8bdf6d3ba2
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-22 01:22:52 +00:00
Baohong Liu e1153004f9 drivers: spi_shim: grant arc the access to spi on I/O fabric
Enable arc to access the spi controller on I/O fabric.

There are two spi controllers on quark se SoC. One is attached
to the I/O fabric and the other one is in the sensor system.
X86 cpu is only able to access the spi controller on the I/O
fabric and the access is supported by existing code. HW allows
arc to access both controllers. But, the existing code only
gives arc access to the controller in the sensor sub-system.
Let's grant arc the access to the controller on I/O fabric as
well by the following changes.

1. Add spi_qmsi.c into arc compilation.
2. Use the already defined macros to choose interrupt numbers
   and do interrupt unmasking automatically based on the
   compilation targets.
3. Add new symbols in Kconfig including driver names for both
   controllers

Jira: ZEP-1190

Change-Id: I40a5d423d4b7986a897834d1a3831938005eda6f
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-22 01:22:26 +00:00
Baohong Liu 0fa409ff48 drivers: adc108s102: use unified kernel
Use new kernel header file and k_sleep from unified
kernel instead of nano timer.

Change-Id: I1c98c07f880382eaa87f6e0c45967a4b8b6bfd7d
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-22 01:22:09 +00:00
Andre Guedes a7006bb53d rtc: qmsi: Fix wrong comment in driver init
Change-Id: I45694013a5e8172cb4a6fddba00fe8f65ec10cd5
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-12-21 20:06:18 +00:00
Benjamin Walsh a1622472c3 drivers: hp206 driver does not need 2000 ticks/s frequency
From code inspection, the driver always took timeouts in milliseconds.
The only sub-ms wait uses k_busy_wait(), which has microseconds
granularity, but its granularity does not depend on the system clock
tick rate.

Change-Id: If48363fd1fbeeb8e5ff0f0f2ca86e671d63bc571
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-21 19:50:06 +00:00
Benjamin Walsh e863a77849 drivers: fix timeout in hp206
It receives a timeout in ms, but was still converting it to ticks, while
the unified kernel API takes a value in ms.

Change-Id: I8ff7f44090716385764fe4b2a087043a2e0d70af
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-21 19:50:06 +00:00
Benjamin Walsh 50f7032fb4 arc/nios2: rename sys_cycle_get_32 to k_cycle_get_32
Oversight from unified kernel effort.

Change-Id: Ib81ead8a38e06b72dc60cdce666d3a4eedf1901c
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-21 19:50:05 +00:00
Anas Nashif 3d8e86c12c drivers: eliminate nano/micro kernel usage
Jira: ZEP-1415

Change-Id: I4a009ff57edb799750175aef574a865589f96c14
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-21 18:45:02 +00:00
Maureen Helm 31862e3a63 fxos8700: Add support for tap and double tap triggers
Adds optional support for tap and double tap sensor triggers to the
fxos8700 driver using the pulse detection hardware function.

Default configuration values were taken from NXP AN4072, section 6.3.
http://cache.nxp.com/assets/documents/data/en/application-notes/AN4072.pdf

Change-Id: Ia95091628a853eb956f6fd1df099a9e6e101b707
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-12-21 08:06:56 -06:00
Sergio Rodriguez b52080749f drivers: gpio_cmsdk_ahb: Fix erronous if statements
The GPIO_INT_LEVEL and GPIO_INT_ACTIVE_LOW values are  zero so the
statements are never executed then is better use the bit complement
masks

This issue was reported by Coverity

Coverity-CID: 157586

Change-Id: Ic8b20660a991dd3d0c71248f84c917e5ce5c3c7c
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-12-21 13:49:40 +00:00
Marcus Shawcroft 6a1632ed26 eth/ksdk: Use k_sem instead of nano_sem
Change-Id: I6b024f6054dede28b74f97102d80ef50f9e45a04
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-21 12:58:11 +00:00
Marcus Shawcroft 4ede76a6f9 eth/ksdk: Use k_sem_init() initial count
Remove the existing code that iterates over k_sem_give() and setup the
initial counter directly, take the opportunity to set the maximum count.

Change-Id: Ib91ea263567ff761e4953c142a22a56658efe293
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-21 12:58:11 +00:00
Flavio Santes 358056692f drivers/usb: Use the right data-type
Use uint32_t instead of int.

Change-Id: I7d73a3fea61e48663aeada6792b9b6c19db1cb35
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:53 +00:00
Flavio Santes 3ec300fd94 shell: Init structure and add the ARG_UNUSED macro
The shell_cmd structure has three parameters and only two were
initialized. So, this commit initializes the remaining parameter
and also adds the ARG_UNUSED macro to avoid compiler warnings.

Change-Id: I667a4e9839ec5acd526df0bb465beb2062518315
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:53 +00:00
Flavio Santes 501dd224ad drivers: Add the ARG_UNUSED macro
Add the ARG_UNUSED macro to avoid compiler warnings.

Change-Id: Ia62125b5e93671aa0ab0891c92ae9fa06fadb09b
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:52 +00:00
Flavio Santes 5799495a5b drivers/sensor: Add the ARG_UNUSED macro
Add the ARG_UNUSED macro to avoid compiler warnings.

Change-Id: I2e0d8ccdcd2d525e109cee6c3bd1035640618eb0
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:51 +00:00
Flavio Santes 3d7d373a2f drivers/sensor/bmi160: Remove compiler warnings
Remove the unused argument and comparing int to unsigned int
compiler warnings.

Change-Id: Iad79ec2ef8206b2494875a93551a0f47e234ff8d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:51 +00:00
Flavio Santes 15932d41cd drivers/slip: Use the right data-type
Use the right data-type to avoid compiler warnings.

Change-Id: I3e807482c5636f37ef1288689450dbe3c9c04dcf
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:48 +00:00
Flavio Santes 0a1c29cda4 driver: Add ARG_UNUSED to console and uart drivers
This patch adds the ARG_UNUSED macros to some function
arguments to avoid compiler warnings.

Change-Id: I628aea55d98cf8519c046ae5835e95cfa70a973f
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:47 +00:00
Matthias Boesl ffa67b77c6 board: add initial support for Nucleo-64 with Soc STM32F411RE
Change-Id: I698693bccce1e9599c20e57f5d4172643ca38cc9
Signed-off-by: Matthias Boesl <matthias.boesl@gmail.com>
2016-12-20 09:15:19 -06:00
Carles Cufi 129a2f0bb6 gpio: nrf5x: Add support for GPIOTE and GPIO callbacks
To support interrupt-based GPIO callbacks in the nRF5x series one needs
to use the GPIOTE module, which has a series of channels that can be
programmed to trigger interrupts on level changes.
This commit adds basic support for the GPIOTE module within the nRF5x
GPIO driver, as well as callback support in order for basic buttons and
switches to work.

Change-Id: I9ae600f894372ad42b09a18cc38a90fc29abb0df
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-20 09:14:49 -06:00
Carles Cufi 3655291d5f boards: arm: Refactor the GPIO and UART dependencies
To make way for the upcoming blinky and GPIO support for nRF5x-based
boards, this change addresses the hardcoded dependencies in Kconfig
default configurations of the different boards, moving the common option
defaults to the SoC default configuration itself.

Change-Id: I8db0750311ad5a12b76237b39438376f20f6f496
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-20 09:14:48 -06:00
Gil Pitney f18cced2c1 cc3200: Add a GPIO driver for the TI CC3200 LaunchXL
The pinmux configuration is done during board initialization.

This was validated using the following Zephyr apps:
 - samples/basic/blinky
 - samples/basic/disco
 - samples/basic/button

All 4 GPIO ports are supported.

Change-Id: If8599a23c1d56cfd678a6e2e5339f7e093c6061a
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2016-12-20 09:14:48 -06:00
Carles Cufi e15c5527ed drivers: serial: nrf5: Undefine MDK macros to avoid conflict
The new Nordic MDK redefines certain UART signal names for backwards
compatibility with the new nRF52840 IC.
This patch addresses the potential name conflict between the redefined
signals and the existing variable names defined in the UART driver.

JIRA: ZEP-1418

Change-Id: I559d9335d2eeaa0a88d3f261b70508a1c98b989d
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-20 09:14:48 -06:00
Marcus Shawcroft f655da2b5e eth/enc28j60: CONFIG_ETHERNET no longer exists.
Change-Id: Ia011aa0ebbf4834bc068564d01cde3309f28a2a4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-20 13:47:33 +00:00
Marcus Shawcroft 9094fdb8c4 eth/config: Group ethernet driver configuration into one menu.
Change-Id: Ieff568916f2c0428719e3e217ce0ca1ddf2908ff
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-20 13:47:32 +00:00
Anas Nashif a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Anas Nashif cfbe9b05a1 kernel: rename NANOKERNEL_TICKLESS_IDLE_SUPPORTED
rename NANOKERNEL_TICKLESS_IDLE_SUPPORTED to
TICKLESS_IDLE_SUPPORTED and remove nanokernel occurances in Kconfig
files.

Make TICKLESS_IDLE depend on hardware that supports it.

Change-Id: I6a2e4fb0f7cf4b45475b48e71823ea089ee98759
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:35 +00:00
Anas Nashif c1f2e26584 timer: hpet: rename debug function to avoid conflict
PRINTK was conflicting, reanme to DBG.

Jira: ZEP-953
Change-Id: If5d6ef385c5ed223f6f7eae9bde887ae4a1b946a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:17:33 +00:00
Anas Nashif 5ad2905532 arm: remove old GDB_INFO support
That module is not used anymore: it was introduced pre-Zephyr to add
some kind of awareness when debugging ARM Cortex-M3 code with GDB but
was never really used by anyone. It has bitrotted, and with the recent
move of the tTCS and tNANO data structures to common _kernel and
k_thread, it does not even compile anymore.

Jira: ZEP-1284, ZEP-951

Change-Id: Ic9afed00f4229324fe5d2aa97dc6f1c935953244
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:17:30 +00:00
Tomasz Bursztyka 4687648a26 drivers: eth_ksdk: Simplifying MAC address generation
The ethernet controller being a freescale one, let's use its OUI. Then
only 3 bytes are needed for generating the rest of the MAC address.

Also, generating the MAC address in the right order.

Change-Id: Id3346ef44f8c24edc2e23dee6ac0581ac58cf4ff
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:55 +01:00
Tomasz Bursztyka 943d55d116 drivers: eth_ksdk: There is a unique L2 driver
Removing useless defines for L2 layer driver.

Change-Id: I53ba6268d8716f293eada29a192fc63324f02523
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:55 +01:00
Tomasz Bursztyka 6480594f0a drivers: eth_ksdk: Theres is no longer 'ETHERNET' Kconfig option
Only NET_L2_ETHERNET now.

Change-Id: Ic9bb3c57e0f91c7eeb53cbbfddab085c723a4a5a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:55 +01:00
Tomasz Bursztyka c1e52674d7 drivers: enc28j60: Removing useless legacy driver
Left over from old IP stack it seems.

Change-Id: Ic7ce731b8661294125fa0e0e058570aeff7b97cf
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:55 +01:00
Tomasz Bursztyka b94042d93b drivers: enc28j60: Expose RX thread stack size and prio config
Such stack size might vary if debug is enabled or not and depending also
on other factors. Let's do the same for priority as well, putting it to
high prio as default (15 is way too low level).

Change-Id: I16afab33895085bacdef087fe70adeb1ae3ca2ab
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:55 +01:00
Tomasz Bursztyka 214970a3a5 drivers: enc28j60: Add logging
Adding relevant error, debug and informational messages.

Change-Id: I0457395a3ac10164f08b3bab0416b769762c6c5a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:55 +01:00
Tomasz Bursztyka 3e62dfbc22 drivers: ennc28j60: There is a unique L2 driver
Removing unrelevant defines for L2 layer driver.

Change-Id: Iae0f11291f4c19134228ccd976127e7f0f0b635f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:54 +01:00
Tomasz Bursztyka c38f1e78eb drivers: enc28j60: Fix one tiny naming issue
ll_len means link layer length, but it's misleading here as ll_len is
the whole net buffer length: reserved ll length + payload length.

Change-Id: If7ec0fc950245d370fa0f82ae1050b05c11c7b90
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:54 +01:00
Tomasz Bursztyka 28255fa014 drivers: enc28j60: Fix a Kconfig comment
s/I2C/SPI obviously

Change-Id: Ia589869694137f5e5302869349a39d090a8fee1d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:54 +01:00
Tomasz Bursztyka 7d6c50d1d0 drivers: enc28j60: Fix a tiny style issue
Change-Id: I39e9caae812903823ed2cdd7ee6510d5bd633820
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:54 +01:00
Tomasz Bursztyka d882e24002 drivers: ethernet: Enable sys log levels depending on NET_ETHERNET_L2
ETHERNET is a left-over from old and now unavailable IP stack.

Change-Id: I488d9ffcfb1fe3589b522dc2d620873daeb892c8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:54 +01:00
Tomasz Bursztyka 58c34af329 drivers: ethernet: Push DW specific Kconfig options to its own file
Note: This driver need to be ported to new native IP stack in order to
be available again.

Change-Id: I7825c8679e66f8a1d44d75c9d53e9da207b743af
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:54 +01:00
Tomasz Bursztyka aa2c4ec452 drivers: enc28j60: Let's remove the CRC in the end of the frame
At this point, if the frame was accepted by the controller, it means
that CRC was valid. Thus, there is no reason to get it in the buffer.
Let's just pop it out from controller's memory.

Jira: ZEP-1361

Change-Id: Ic8681c77b0afa30583c7fae281db1a89ff97ed2b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:54 +01:00
Baohong Liu f2c1b4bb02 drivers: bmi160: use direct GPIO trigger instead of IPM
Directly use AON GPIO trigger instead of IPM.

In the past, SW did not allow arc to receive AON GPIO interrupt.
So, interrupt from BMI160 was routed to x86 cpu. Then, x86 cpu
passed the event to arc through IPM. But, SW was updated and arc
is able to directly receive interrupt from AON GPIO now. So, IPM
is not needed any more. Let's remove IPM related code and use
GPIO as the default trigger source.

This change is on top of the bmi160 sample app change to not use
IPM.

Change-Id: I49d8040764d03b24e09d89e66643c020ef63a3c9
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-16 15:56:33 +00:00
Qiu Peiyang 597349207a drivers: sensor: replace device sync APIs with semaphores
Device sync APIs are actually wrappers for semaphores.
Let's replace them with semaphores.

Jira: ZEP-1411

Change-Id: I77c5c749f9e263f172d2ea7c0c0088eb9e68d235
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-12-16 13:30:30 +00:00
Jon Medhurst bcb31523d5 uart_cmsdk_apb: Fix cut'n'paste error in device 4 init code
Change-Id: I2f11dc0da3ad8be970ac15187fb35264ef7dc0e8
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2016-12-16 12:53:52 +00:00
Anas Nashif 8ec1d4f921 Merge "Merge bluetooth branch into master" 2016-12-16 12:51:47 +00:00
Carles Cufi ca0951d42d drivers: timer: Optimize RTC driver and prevent past events
The nRF RTC driver, which is used a system clock driver due to the lack
of SysTick hardware on the SoC, was using too much CPU time in its
_timer_idle_exit() implementation due to the use of 64-bit arithmetical
operations. This was causing the ISR wrapper to add excessive latency to
critical interrupts, causing BLE controller asserts.
This patch addresses the issue by using exclusively RTC ticks instead of
OS ticks, thus avoiding the necessity to convert during
_timer_idle_exit() calls, which are the most critical to interrupt
latency.

In addition the driver is now able to detect setting tick events in the
past due to it being interrupted by a higher priority context, and will
reschedule and trigger the ISR at the same time.

Change-id: I56a3be96b9fdd554c3650012d647af2f0415eb8a
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-16 12:51:15 +00:00
Johan Hedberg 1c9da665c3 Bluetooth: Remove unnecessary runtime kernel object initialization
There are static initializer macros available for most kernel objects
which we should use whenever possible.

Change-Id: I496f4d05d26801eddd21fae53bdd4fcdc3246fe3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-16 10:27:48 +02:00
Tomasz Bursztyka 33479ec739 drivers: spi: Fix the help on sys log level
Change-Id: Ifdd63dc2930e43240b6aa3afc0fced92ba4d74cb
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-15 14:33:21 +01:00
Julien Delayen d127864366 arcv2_timer0: Add suspend and resume support
When going into DEEP_SLEEP state, the ARC timer
needs to be restored.

This implements the function to restore the timer
after sleep.
As the time spent during sleep is not currently known,
the timer is expired to reschedule the application task.

Jira: ZEP-1224

Change-Id: I22a30d0fd79f177cf166b9a29dc78d68f7d7fbad
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-15 12:49:32 +00:00
Julien Delayen cd8504cc9c arcv2_irq: Add power management suspend/resume
In order to resume the ARC from deep sleep,
the interrupts need to be restored.

The FIRQ stack needs to be saved and restored
when performing sleep operations.

During early initialization, the sp in the 2nd register bank
is made to refer to _firq_stack.
This allows for the FIRQ handler to use its own stack.
Fast Interrupts cannot be used after sleep if this information
is not restored.

This patch adds the suspend and resume functions.

Jira: ZEP-1223

Change-Id: Ic81980f05aee6c1f7b8c46c743f2648c65b29486
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-15 12:49:31 +00:00
Julien Delayen 2008af30e7 arc: Define _arc_v2_irq_unit device
Move interrupt initialization for the ARC to its own
device. The init function for the arc will be only
doing platform specific operations

Jira: ZEP-1288

Change-Id: Icb04c3622890021c65cd24cecf6cafee6c37caf9
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-15 12:49:30 +00:00
Johan Hedberg 71c7c01819 net: buf: Remove the need for net_buf_pool_init()
In order to keep the initialization process light-weight, remove
net_buf_pool_init() and instead perform the initialization of the pool
and buffers in a "lazy" manner. This means storing more information
in the pool, and removing any 'const' members from net_buf. Since
there are no more const members in net_buf the buffer array can be
declared with __noinit, which further reduces initialization overhead.

Change-Id: Ia126af101c2727c130651b697dcba99d159a1c76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:02 +02:00
Marcus Shawcroft 954baea90b random: Restructure RANDOM Kconfig
Restructure the RANDOM Kconfig to match the structure used in other
drivers with a single top level menu.  Move the true random number
generators to appear first in the menu, with pseudo generators at the
bottom.  Do not present pseudo generators if a true random generator
is presented.

This change implies that tests, samples and applications that require
the random driver interface must now select CONFIG_RANDOM_GENERATOR.

In order for tests and samples to build (and run) on platforms that
have no random driver it remains necessary to select
the CONFIG_TEST_RANDOM_GENERATOR.

Note that CONFIG_TEST_RANDOM_GENERATOR retains its original purpose of
enabling a random driver that delivers non random numbers for the
purpose of testing only.

Change-Id: I2e28e44b4adf800e64a885aefe36a52da8aa455a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:18 +00:00
Bogdan Davidoaia de4727ba3f sensor: update drivers to not return double values
Update drivers to return INT_PLUS_MICRO values instead of doubles.

This hides the fact that the drivers use floating point operations and
doesn't force the application to use them as well.

Change-Id: I14c6faecb35331c2fdbdab41bc624d751de984b8
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:11 +00:00
Bogdan Davidoaia 708fe8c1e3 sensor: use integers for simple value calculations
Use integers for sensor value calculations in which doubles are not
required.

Change-Id: I8662023ca596cb232e31849b0b77ae2bf0372cf0
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:10 +00:00
Bogdan Davidoaia 4946e3e6e6 sensor: remove SENSOR_VALUE_TYPE_INT
Remove SENSOR_VALUE_TYPE_INT as it is the same as
SENSOR_VALUE_TYPE_INT_PLUS_MICRO with val2 set to 0.

Change-Id: If5a9c579b7267701c27f40fd887acae47d64edc5
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:10 +00:00
Johan Hedberg c3e08c8fea net: buf: Redesigned pool & buffer allocation API
Until now it has been necessary to separately define a k_fifo and
an array of buffers when creating net_buf pools. This has been a bit
of an inconvenience as well as blurred the line of what exactly
constitutes the "pool".

This patch removes the NET_BUF_POOL() macro and replaces it with a
NET_BUF_POOL_DEFINE() macro that internally expands into the buffer
array and new net_buf_pool struct with a given name:

	NET_BUF_POOL_DEFINE(pool_name, ...);

Having a dedicated context struct for the pool has the added benefit
that we can start moving there net_buf members that have the same
value for all buffers from the same pool. The first such member that
gets moved is the destroy callback, thus shrinking net_buf by four
bytes. Another potential candidate is the user_data_size, however
right not that's left out since it would just leave 2 bytes of padding
in net_buf (i.e. not influence its size). Another common value is
buf->size, however that one is also used by net_buf_simple and can
therefore not be moved.

This patch also splits getting buffers from a FIFO and allocating a
new buffer from a pool into two separate APIs: net_buf_get and
net_buf_alloc, thus simplifying the APIs and their usage. There is no
separate 'reserve_head' parameter anymore when allocating, rather the
user is expected to call net_buf_reserve() afterwards if something
else than 0 headroom is desired.

Change-Id: Id91b1e5c2be2deb1274dde47f5edebfe29af383a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-13 21:41:53 +00:00
Sergio Rodriguez 1e2e05c784 drivers: sensor: fxos8700: Fix uninitialized variable
This issue was reported by Coverity

Coverity-CID: 157621

Change-Id: I7f84c0868467ab55e033aecac037967da001a6db
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-12-13 11:36:27 +00:00
Baohong Liu 683cb88777 drivers: adc: replace device sync APIs with semaphores
Device sync APIs are actually wrappers for semaphores.
Let's replace them with semaphores.

Jira: ZEP-1411

Change-Id: Ic37972a631f0bfd7bc45f28088e1c423151b1612
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-11 11:26:06 +00:00
Baohong Liu 130ac06a02 drivers: spi: replace device sync APIs with semaphores
Device sync APIs are actually wrappers for semaphores.
Let's replace them with semaphores.

Jira: ZEP-1411

Change-Id: I02c7cba21d21ff9288e452121e3b7ebb7d251bb4
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-11 11:25:42 +00:00
Baohong Liu fd314e721e drivers: i2c: replace device sync APIs with semaphores
Device sync APIs are actually wrappers for semaphores.
Let's replace them with semaphores.

Jira: ZEP-1411

Change-Id: I5662057222aec54f02db9d9cdcd7f4f006c6c530
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-11 11:23:34 +00:00
Marcus Shawcroft a715194d43 random: Rewrite sys_rand32_init() with SYS_INIT()
Use the SYS_INIT() mechanism to invoke the sys_rand32_init() function
in random drivers that require an initializer.  Remove all empty
sys_rand32_init() instances.

The existing explicit sys_rand32_init() function runs immediately after
PRE_KERNEL_2 before stack canaries are initialized.  In order to get
equivalent behaviour with sys_rand32_init() we set SYS_INIT() to
initialize the random drivers at the lowest priority of PRE_KERNEL_2.

Change-Id: I4521e44daac806bc4eef01ce7fdf2ba5367e0587
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-11 11:18:18 +00:00
Marcus Shawcroft a94437c03c sensor: Add nRF5 temperature driver.
Basic interrupt driven driver for the nRF5 onboard temperature sensor.

Change-Id: Id0ac303293b8e8b8285b19bcda31284ee6617105
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-11 11:14:05 +00:00
Maureen Helm 57e1975241 pinmux: Deprecate the k64 pinmux driver
Now that we have a more generic ksdk pinmux driver that can be used
across multiple Kinetis SoCs, deprecate the specific k64 pinmux driver.

Jira: ZEP-1393
Change-Id: I11cfe9a53746a6e85eced2a7cecf0396d42a7a19
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-12-10 21:14:13 +00:00
Maureen Helm a4e823eee0 pinmux: Introduce new ksdk pinmux driver
Kinetis SoCs contain one or more PORT modules to handle pin muxing and
pin configuration. Unlike the existing k64 pinmux driver, this driver
handles each PORT module individually and can be used for other Kinetis
SoCs.

This driver uses KSDK CMSIS register accesses to the PORT module rather
than the KSDK PORT driver (fsl_port.h), because the Zephyr pinmux
interface contains both set() and get() functions to access the pin
configuration. The KSDK PORT driver only contains a set() function
(which is a very thin static inline function to modify the PCR
register), therefore building a shim on top of it would result in a
strange mix of using the KSDK PORT driver for the set() and a direct
CMSIS register access for the get().

Jira: ZEP-1393
Change-Id: I2f7c6b08b207350697d590dcd665223f81de9f9e
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-12-10 21:14:11 +00:00
Anas Nashif cb70d7d04d Merge "Merge bluetooth branch into master" 2016-12-10 02:17:38 +00:00
Kumar Gala 1ecaa78aaa drivers: slip: remove unneeded include path addition
subdir-ccflags-y +=-I${srctree}/subsys/net/ip isn't need so lets
remove it.

Change-Id: I60d97ce25398d7d3801e837075dbf75d1375e055
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-10 02:15:49 +00:00
Kumar Gala 41c6493472 drivers: timers: remove unneeded include path addition
ccflags-y += -I$(srctree)/kernel/unified/include isn't need so lets
remove it.

Change-Id: I910bbac4a189de965d844f5fc36571e8dcb5705d
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-10 02:15:49 +00:00
Kumar Gala fe144ff2d4 drivers: usb: remove unneeded include path additions
We can locally reference the file we need, so don't add a -I we don't
need.

Change-Id: I4d9507d5368073443dcc78a5821fe09d3e0b9bfc
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-10 02:15:48 +00:00
Baohong Liu b3195581e7 drivers: sensor: add missing license header
Change-Id: I0d666ba8a83ea523dd15cdc94f0565fee9f7288e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-09 17:39:05 -08:00
Kumar Gala 49cd3b1891 drivers: bluetooth: nble: remove unneeded include path additions
We can locally reference the files we need, so don't add a -I we
don't need.

Change-Id: I764aea4177a8995489e0f15f71f7373427b43394
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-09 08:18:24 +02:00
Johan Hedberg a4b6b2417d Bluetooth: Switch from printf to printk functions
There's now snprintk available that's more light-weight on the stack
than snprintf.

Change-Id: I6b3e4409703ca92fe6b8f4146ff47c490ab826cb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-09 08:18:24 +02:00
Johan Hedberg 30277538e7 drivers/ethernet: Fix SYS_LOG_DBG format specifier for MAC
The SYS_LOG macros now map to printk by default, and printk doesn't
(currently) support %2.2x, rather %02x needs to be used instead (it
gives the same result).

Change-Id: I0f7a5b7da91afba0c970bce7e2680de40c917bd3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-07 18:45:17 +02:00
Johan Hedberg 9aafa973df Bluetooth: Fix incorrect logging format specifiers
Fix compilation issues that show up if SYS_LOG is mapped to printk
instead of printf. Unlike printf, printk is annotated so that the
compiler catches incorrect format specifiers passed to it.

Change-Id: I4d6f635a0ed61de698727028ea8767dc0ef28bb1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-07 13:15:59 +00:00
Erwan Gouriou 4827f2f386 pwm/stm32: add PWM driver for STM32 F1/F4/L4
Provide PWM driver for STM32 series F1/F4/L4.
Driver is ported on STM32Cube HAL and should support other STM32
series with minor updates.
Configuration is done so that PWM sample driver could be run on
all nucleo boards supporting PWM driver.

Change-Id: I6522a565451085df932e0eefd8404268380b5bfe
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2016-12-06 10:31:46 -06:00
Erwan Gouriou 971de25439 pinmux: prepare support for stm32 PWM driver
Add pin config for PWM support on ST Nucleo boards
Following config is chosen:
-PA0/PWM2_CH1 for F401RE and L476RG
-PA8/PWM1_CH2 for F103RB

Change-Id: I013e15ed35360d7777bb24ff94e0830f913a6580
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2016-12-06 10:31:45 -06:00
Vincenzo Frascino fb7d483fbe counter: cmsdk: Add Timer 0 and 1 as Counters
This patch adds Timer 0 and 1 to be used as counters.

Jira: ZEP-1300
Change-Id: I9d8b971d8a3d76eee2f9cc4600e95729d67717a3
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-12-06 10:31:45 -06:00
Vincenzo Frascino 8e44a5aa0e watchdog: Add driver for CMSDK APB WDOG
Add driver for CMSDK (Cortex-M System Design Kit) APB WDOG. This device
uses NMI as interrupt hence it requires Runtime NMI (CONFIG_RUNTIME_NMI)
to be configured in the platform.

Tested with drivers/watchdog sample application.

Jira: ZEP-1300
Change-Id: Ib318047109af81e32060e80d456ef3873fd380ea
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-12-06 10:31:45 -06:00
Vincenzo Frascino 1589b7fa5d uart: Enable clock control in CMSDK APB UART driver
This patch enables the clock control interface into the ARM LTD
CMSDK APB UART driver.

Jira: ZEP-1300
Change-Id: Ic0a214beb02d56ffb02ad4e6ca26b80805c0a4e6
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-12-06 10:31:45 -06:00
Vincenzo Frascino 8ca930a5c0 gpio: Enable clock control in Beetle GPIO driver
This patch enables the clock control interface into the ARM LTD
Beetle GPIO driver.

Jira: ZEP-1300
Change-Id: I576767b68a8e4aa965d34716528df3bb4e837d73
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-12-06 10:31:45 -06:00
Vincenzo Frascino 6be2a81ae4 clock_control: Add Beetle clock_control
This patch adds the clock_control implementation for the ARM LTD
Beetle platform.

The main features enabled are:
* Clock on and off in ACTIVE, SLEEP and DEEPSLEEP mode.
* PLL support (freq: 12, 36, 48 Mhz).

The integration with the existing drivers will be done in future
patches.

Jira: ZEP-1300
Change-Id: I07cb2325275bd86a036e8e24aeb7bbf2c6176a93
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-12-06 10:31:45 -06:00
Neil Armstrong afe71f61e7 nucleo_l476rg: add board support
Add board support for the Nucleo64 L476RG development board.

Change-Id: Ibb5424bc936c67a5d96855617202136d7dea772c
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2016-12-06 10:31:45 -06:00
Neil Armstrong abae57ac30 stm32lx: add i2c driver for the L series
Add the I2C for the STM32Lx series

Change-Id: Id1694aeb3606b4fa9772bfb7a9f60e48a7cc93a8
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-06 10:31:45 -06:00
Neil Armstrong f8699b5754 pinmux/stm32: add pinmux definition for i2c
Add all possible pin assignment definitions for I2C{1-3} on STM32L4xx.

Change-Id: I2d4266bc3bb9ba41b74a80567c0b04a89963753e
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-06 10:31:45 -06:00
Neil Armstrong a7edb4b336 stm32l4: add pinmux for USARTs
Add macro for all the available pinmux for the USARTs present on
STM32L4.

Change-Id: Ie4352750e1c6f08642b3e222b57f2a791f08ef74
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-06 10:31:45 -06:00
Neil Armstrong c34b0e0ac3 stm32l4: add exti support
Add EXTI support for the STM32l4XX family.

Change-Id: Ia92f26eaf49899ea23fae05dd3a7357007c9db20
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-06 10:31:45 -06:00
Neil Armstrong 16df88e678 stm32l4: add gpio support for l4
Add the support for all the GPIO port of the L4.

Change-Id: Id365e17223cd5c49443df9fb6b96a3c4f204f523
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-06 10:31:45 -06:00
Neil Armstrong 3842c60ce3 stm32l4: add clock control driver
Add the clock driver for the STM32L4 series.

Change-Id: Icdf79061f163d8d00187b382d1564422fb875c5b
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-06 10:31:41 -06:00
Fabien Parent fea5c561fa stm32l4x: pinmux: add support for STM32L4
Change-Id: Ie505fe285d21070a98f2032cfd800a97095efa88
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-06 10:30:50 -06:00
Erwan Gouriou 0bf6c3860d uart: stm32: Add support for STM32L4X
Deal with STM32L4X additions for clock and interrupt handling to the
uart driver.

Change-Id: I6e8dafb132dafea54b8f31a3a5cb6e35a207574d
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-12-06 10:30:45 -06:00
Erwan Gouriou 2fcf3435c1 serial: Provide new numbering scheme for stm32 UART
There was a misalignment between Zephyr UART device numbering and
SoC UART IP. Device "UART_1" was mapped to IP USART_2, which could
be confusing for user.
This commit allows to align "UART_1" to IP USART_1.
Change is propagated to all STM32F103RB/STM32F401RE based boards and
respective pinmux drivers

Change-Id: Ia8099dfeec7b9c0c686c2a58ccb4dbb1a55b6537
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2016-12-06 09:50:11 -06:00
Erwan Gouriou 8c079e91c9 serial: Provide STM32Cube based serial driver on stm32f1, stm32f4
STM32Cube based implementation allows single driver file for
all stm32 based SoCs.
By maximizing code reuse, use of STM32Cube eases new SoCs
porting into Zephyr and provides better maintanability and
maturity.

Change-Id: Ief4b723add3dfc8b2a839683559c5a4c5d5eb837
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2016-12-06 09:50:11 -06:00
Anas Nashif 70f9244db7 Merge "Merge net branch into master" 2016-12-05 15:56:26 +00:00
Flavio Santes b04cdcd6e6 drivers: Remove legacy nanokernel.h include
This commit replaces the nanokernel.h include by kernel.h.

Change-Id: Ib42fbf2d9f77a73c0831f569b3dbbfb342ea2e1d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-04 14:59:37 -06:00
Maureen Helm 550b02e438 fxos8700: Add support for data ready trigger
Adds general sensor triggering support to the fxos8700 driver, including
options for the driver to use its own thread or the global workqueue
thread to handle sensor interrupts. Adds specific support to handle the
data ready sensor trigger.

Jira: ZEP-1395
Change-Id: I092f22e35747b92a88eb71a3d162a4fc16227b45
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-12-04 12:37:47 +00:00
Johann Fischer 212f5f28ed drivers: spi_k64: Fix RX overflow
This patch fixes RX overflow error in the k64 SPI driver.

Jira: ZEP-1351
Jira: ZEP-1352

Several circumstances lead to an RX overflow:

The RFOF_RE (RX fifo overflow) must not be set as default.
The flag is only set when rx_buf is available. Also it must
be checked inside spi_k64_isr whether RFOF_RE has been set or not.

If the rx_buf is not available and the incoming data
should be ignored, then MCR_ROOE need to be set.
Since it is not possible to change the MCR register
during the transfer, RX fifo must be emptied
if rx_buf_len < tx_buf_len.

The driver also uses spi_data.xfer_len now,
the variable was already defined. Now, transfers are also
possible if tx_buf_len < rx_buf_len (e.g. read slave device register).
spi_k64_push_data has been adjusted accordingly.

The patch simplifies the handling of interrupts.
The interrupts are also switched off in the event of an error.

The patch also fixes a few coding style issues.

Change-Id: I6ce81f595bb1edbbf2253b6595602896ca652762
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2016-12-03 21:37:09 +00:00
Johann Fischer 4ba5f879a6 drivers: spi_k64: Remove non existent CONFIG_SPI_DEBUG
Remove non existent CONFIG_SPI_DEBUG and replace cnt
with DBG_COUNTER_* macros.

Jira: ZEP-1351
Jira: ZEP-1352

Change-Id: I1fba7aaead1ad0b36297b069e5a83e25b7991588
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2016-12-03 21:37:08 +00:00
Andrei Emeltchenko 70f4cd4502 drivers: spi_k64: Clear RX and TX FIFO before starting transfer
Clear RX and TX FIFO before starting transfer fixing RX overflow issue
on FRDM K64F board.

Change-Id: I9345a0058a6c7958a6ecf3dc23b99fe7bff18796
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-03 21:37:07 +00:00
Andrei Emeltchenko 2057eea136 drivers: spi_k64: Fix logging in SPI driver
Logging in spi_k64 driver is based on printf-like functions and does
not make sense with syslog which adds additional information like
function name and new line already.

Change-Id: I84a81ebf5c3cc94b311a2e41bdb5f014432d2b09
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-03 21:37:07 +00:00
Andrei Emeltchenko 894a99cc3a drivers: spi_k64: Add debug and error messages
Change-Id: I81736c59c25dffb226094b3649623383116454a3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-03 21:37:06 +00:00
Andrei Emeltchenko fa9200ee0b drivers: spi_k64: Correct init priority for SPI
Use configured init priority same way it is used for other SPI
drivers. Default priority initializes SPI before console hiding
possible errors and debug messages.

Change-Id: Iddc9c783290d852caa8a9385de4ab114f8f7a2e3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-03 21:37:05 +00:00
Andrei Emeltchenko 850e121ea7 drivers: spi_k64: Fix compile error when syslog is enabled
Fixes following error:
...
drivers/spi/spi_k64.c:717:86: error: 'cnt' undeclared (first use in
this function)
...

Change-Id: If49fa4838265cd39a6f72eb265388ff7faae9a9e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-03 21:37:05 +00:00
Andrei Emeltchenko 6e959810aa arm: frdm_k64f: Enable SPI0 in pinumx
Configure SPI 0 pins in pinmux.

Change-Id: I069ece3ab172e87301a427785a1b6fa9ff57d46a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-03 21:37:04 +00:00
Carles Cufi 5f1c6ee2c8 console: Add a Segger RTT console driver
The Real Time Terminal functionality of the Segger J-Link
debug probe and software suite allows applications to write
to a certain RAM area that is read in real-time by the
debugger. This is specially useful when a UART is not
available to provide a console.
This commit adds a console driver that outputs over an RTT
"connection".

Change-Id: Ifce8020060e9f519a61f3f1fbe9f56f98da2ef7f
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-03 15:24:39 +00:00
Flavio Santes 290a2aba88 drivers: Remove unused parameter warning
This patch fixes the unused parameter warning found at the
following drivers:

- adc_ti_adc108s102.c
- gpio_dw.c
- gpio_k64.c
- exti_stm32.c
- pinmux_dev_atmel_sam3x.c
- pinmux_dev_k64.c
- pinmux_dev_stm32.c
- uart_atmel_sam3.c

Change-Id: I76a17d19176683130d57e8f48e5195e7785060f3
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-03 14:49:08 +00:00
Baohong Liu b0cdc4bce3 drivers: spi_shim: add return value check
Add function return value check. This was caught by
Coverity.

Coverity-CID: 157124

Change-Id: I93b23325d657dc787300908b9117b6976617fdba
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-03 00:37:05 +00:00
Anas Nashif 91b47b9d3c sensors: change init level from NANOKERNEL to POST_KERNEL
Change-Id: Iba788e2b0b60d89e6b9bf6f5de73ff2f5cdbebbc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 15:52:34 +00:00
Tomasz Bursztyka efe6f50892 drivers: ieee802154: cc2520: Debug cleanup
- Removing SYS_LOG_NO_NEWLINE
- Enabling gpio/exceptions print out on full debug mode
- Fixing style issues around debug routine calls

Change-Id: I5e4c01c9051a6aae169269d4bfddd4fca0365faa
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:21 +02:00
Tomasz Bursztyka 589a361e53 drivers: ieee802154: cc2520: Rename RX stack Kconfig option
Fibers do not exist anymore in unified kernel.
Also, let's just use that option directly so removing the internal
define which is then useless.

Change-Id: I1179d84401934b339d3a9ccd12f6145a120bcb2f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:21 +02:00
Tomasz Bursztyka 386b2f9ec9 drivers: ieee802154: cc2520: Let's use only symetrical tx/rx spi buffer
Other driver than QMSI might have this limitation. Let's wait for a
future rework of SPI API to properly fix that.

Change-Id: Ibad382ce86e7479961b275c4851abf88ed581023
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:20 +02:00
Tomasz Bursztyka ba90139cbd ieee802154: cc2520: Externalize how GPIOs are configured
Currently it's only possible to configure those GPIOs through
boards.<h/c> files and thus it's not relevant for board that do not
embed cc2520 but might get one wired to it, unlike
quark_se_c1000_devboard which directly embeds one cc2520.

Change-Id: I819bc1d2de707ea12eb70dc60a40b28f92666e51
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:20 +02:00
Jukka Rissanen 3eaec41ab8 net: Moved net/ to subsys/net
* Moved networking code into subsys/net.
* Renamed net/yaip to net/ip at the same time.
* Fixed the tests/net to compile
* Fixed the Makefiles and Kconfig files in subsys/net
  to use the new location of the IP stack

Change-Id: Ie45d9e8cb45a93fefdf969b20a81e3b1d3c16355
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:20 +02:00
Jukka Rissanen b4cba17408 net: Fix stack info collector in net shell
The cc2520 driver RX thread did not like the stack information
collection macros defined in net_core.h. Both the cc2520 TX and
RX got the same variable name which did not compile.
This is now changed so that the first parameter is added to
the variable name to create a unique variable.

Change-Id: Ia41d01a71afd73af2ef31aa5f7a890a3cf0385aa
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:18 +02:00
Jukka Rissanen 68ea9377e6 net: Make native IP stack the default
As the native IP stack is now the default, there is no need
for corresponding Kconfig option.

Change-Id: I08e4992f540f928a2b7378e8803e634e38725348
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:17 +02:00
Jukka Rissanen 6b43821f20 net: Remove legacy Contiki based uIP stack
This commit removes the legacy Contiki based uIP stack.
The new native IP stack must be used after this commit.

The commit also removes following things:
- legacy cc2520 driver
- legacy ethernet drivers
- legacy IP stack samples

and changes these things:
- disabled tests that only work for legacy IP stack
- select new IP stack by default
- enable random number generator by default as it is needed
  by the new IP stack

Change-Id: I1229f9960a4c6654e9ccc6dac14a7efb9394e45d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:17 +02:00
Jukka Rissanen f2b7492269 ethernet: Add driver initialization priority to Kconfig
The default kernel init priority is too low. Make this
configurable and set the default priority so that the
ethernet driver is started just before the network stack.

This commit adds generic ethernet priority and changes
currently available ethernet drivers to use it.

Change-Id: If695e52b6dd9ea227f10ba306bb145d72d2312b0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:17 +02:00
Mahavir Jain e12d73e45e ethernet: enc28j60: use unified kernel interface
Remove legacy kernel interface and use unified APIs

Change-Id: I8e99aa5399707a28a326e8abfa8725079de31be6
Signed-off-by: Mahavir Jain <mjain@marvell.com>
2016-12-02 12:41:17 +02:00
Andrei Emeltchenko 4abf1a26f6 drivers: cc2520: Inform about missing SPI device
Refactor code to exit earlier in case of error.

Change-Id: I9ff893f923ff877d69b0e985bb6e4159504e67cd
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:17 +02:00
Juan Manuel Cruz 9e36897455 ethernet: enc28j60: fixes an issue caused during an internal rebase.
The original commit:

https://gerrit.zephyrproject.org/r/#/c/6256/

has changed because an internal rebase. Two lines adding an SPI
command are missing.
This commit adds back the missing lines.

Change-Id: I5cbeda73ef1eae5eb98dfa3b7f3086b7438da9a9
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-12-02 12:41:15 +02:00
Jukka Rissanen cdc56a0893 drivers: ieee802154: RX stack debug enhancements
Use the stack declaration macro from net_core.h which
allows user to see more information about stack usage
when using net shell.

Change-Id: Id3cc0fa49c5da79ba7d5573103864f1881e2f2e5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:14 +02:00
Jukka Rissanen 0f8be63d8e ethernet: ksdk: Use unified kernel API
Dropping legacy API.

Change-Id: Id3d0b3e4ac7834e78a4d70ee5c99c6998958921e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:14 +02:00
Tomasz Bursztyka 1a22f76364 drivers: ieee802154: Fix cc2520 raw mode
Hack in commit-id 835f93b8250abc0f3edbee9a99463fccac03597c was breaking
raw mode needed for wpan* adaptations.

Change-Id: If1ff96fa8170cc84e356fb0452e487f0ff174da5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:13 +02:00
Andrei Emeltchenko 88b41debd8 drivers: ieee802154: cc2520: Log errors when starting/stopping cc2520
Change-Id: I55efbfcd91da48b98654a5d1dfcbf02b2d76cf75
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:12 +02:00
Andrei Emeltchenko 75844e7847 drivers: ieee802154: cc2520: Flush RX fifo earlier when stopping
flush_rxfifo() leaves fifop interrupts enabled.

Change-Id: I76d5e270982e2cd8f958417f310c1d3547bc061d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka 1e39eabcb7 drivers: ieee802154: Set a fake MTU of 125 instead of real 127
This is a hack, related to:
commit-id 835f93b8250abc0f3edbee9a99463fccac03597c

Change-Id: I7e305cef9ca908e2a71a011920663e1603ad8d6e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka 7a11439020 net: ieee802154: Fix current stack to completely drop CRC handling
The 802.15.4 frame has a header and in the end after the payload a CRC.
Overall MTU is 127 bytes, but CRC is most likely going to be generated
by the device itself (offloading). Because the limitation of current
nbuf, it's not possible to keep this CRC in the buffer because it
require a user data size of 127 bytes but if we do so, IP stack will
fill in as much as it can as packet data, thus occupying the 2 last
bytes. This generates bugs. A perfect solution would be to generalize a
better handling of MTU and head or tail reserve data into nbuf, but
this will probably be solved in the future.

Change-Id: I1a0fee4d555e2717c1edd5afba399a1f17d9c7a9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:11 +02:00
Andrei Emeltchenko afc122eeec drivers: cc2520: Remove double space in debug and errors
commit-id 67c465d2cc introduced this
weird format by not removing unnecessary spaces.

Change-Id: I964185c8a894cfcf10e253e6d378c63ec02ad8d7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:07 +02:00
Tomasz Bursztyka ed6ccead1e drivers: ieee802154: Let the initialization priority be done via Kconfig
Since the whole init level changes: all drivers and most of subsystems
are initialized at level POST_KERNEL. Unfortunately that broke legacy
tweaks on what to start first and after.

Let's raise cc2520 priority, still below net_init.

Jira: ZEP-1261

Change-Id: I0d91aa87a893584b3f5b39a193c823127961402f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:07 +02:00
Tomasz Bursztyka 764cd1118b drivers: ieee802154: Using unified kernel API
Dropping legacy API.

Change-Id: Ifa3b61082036b0f7b593f1f28a30a1d0ad18e179
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:06 +02:00
Tomasz Bursztyka 9c1d4c934d drivers: ieee802154: cc2520: Priority range is now 1-15
Thus setting a high priority of 2 on the rx fiber, as 0 is invalid.

Change-Id: I44a95f3648ca3fbf2eb699f1fa36963d6f3e5021
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:05 +02:00
Tomasz Bursztyka 23f6eb9953 drivers: ieee802154: Implement get_lqi() relevantly
Change-Id: Idc433b77ea3cb38af648d70ad285429c29e53c08
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:04 +02:00
Tomasz Bursztyka aa54086dc6 drivers: ieee802154: Fix some old left-over before multi-frag support
And take the opportunity to reduce the buffer size, as 127 is the 15.4
MTU, it has just engouh space on 128 bytes for the spi cmd plus the
frame.

Change-Id: Ifdeb83f85ab1adcdebc55bd72c38a98f18a86dbc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:04 +02:00
Flavio Santes 69d9dfb027 net/eth: Fix priority value for the ENC28j60 Ethernet driver
Current value (100) is outside the default values: 0 - 15.

Jira: ZEP-1231

Change-Id: Ib3120b52e6eb3d95b369debd7df541fa2b0dfa6e
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:41:04 +02:00
Tomasz Bursztyka 9313172f84 drivers: ieee802154: Let's timeout on cc2520 tx
Looks like getting an SFD interruption is not 100% reliable, so let's
just use a semaphore with a timeout on it instead of using
device_sync* routines.

Change-Id: I4e4115c7b939c95d7e75fbb33664d411e0a6e8cc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Tomasz Bursztyka d33c883eaf drivers: ieee802154: Rework RX buffer handling in cc2520
Flushing rxfifo is necessary only on complete failure. It's badly
documented, but cc2520 errata mention that srxflush instruction should
be avoided as much as possible because it generates garbage in rxfifo
and kills incoming rx packet.

Change-Id: I486f7f4179103cf0c86c206821a0a61fec06178a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Tomasz Bursztyka f8ec175aa7 drivers: ieee802154: Fix length handling in uart-pipe
15.4 drivers are supposed to append LQI byte in the end of the buffer,
but of course there is no such thing in uart-pipe. Thus the bug, so
let's announce the proper length even if such LQI is missing.
Also align the debug output to proper length (FCS included)

Change-Id: Ib9ad86a8c22e1cf6437bc82e7fce11a489d0e761
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Paul Sokolovsky ad064e1434 eth: ksdk: Protect Ethernet frame buffer operations with IRQ lock.
As there's a single intermediate frame buffer used by both RX and TX
routines, protect operations on it with irq_lock() to avoid possibility
that it will be concurrently modified.

Change-Id: Ibbaf882a15fbb193054dbb13ae848becf9deef3f
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2016-12-02 12:41:01 +02:00
Paul Sokolovsky 8b1769a923 eth: ksdk: Update driver for native IP stack.
This updates driver for Kinetis SDK Ethernet device (used for example
by BOARD=frdm_k64f) to work with native Zephyr IP stack driver model.
The conversion is done based on the template of eth_enc28j60.c.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: Ifb0c7d3f921d663d00a2ded89ecdf2336b6e3783
2016-12-02 12:41:01 +02:00
Sergio Rodriguez 20424d5cc6 enc28j60: Fixes change to proper register bank
The register being set before checking the count of the remaining
packets is incorrect, so this code fixes it by setting the proper
register bank before access

Jira: ZEP-1138

Change-Id: Id49ee8439665ff69786f22e13e0d94a2148e4ae7
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-12-02 12:40:58 +02:00
Juan Manuel Cruz 9f1a656511 enc28j60: Fixes an issue with concurrent tx and rx
The ENC28J60 hardware module does not support concurrent
transmission and reception.
This fix adds a control semaphore to exclude the execution
of both processes.

Applies the equivalent changes to the legacy driver.

Jira: ZEP-1097

Change-Id: I9602195d5a97f8d4bf652753c284d61f192357fe
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-12-02 12:40:58 +02:00
Juan Manuel Cruz d0cf3deb96 enc28j60: Improves interface with native IP stack
Tranmission:  Consider that fragments are no adjacent.

Reception:    Consider receiving data in more than one fragment.

SPI routines: Align SPI fragment size with default buffer fragment
              size (128 bytes) for better performance.

Change-Id: I51fc25d8540c36f3719e617a6f33cdea3f63032c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-12-02 12:40:58 +02:00
Juan Manuel Cruz 39779184ad enc28j60: Fixes a reception issue for big frames.
Everytime the devices receives a frame with odd length it will
add an extra byte of padding to the reception buffer.

This was causing and issue when receiving frames above 64 bytes
length and with odd length.

This commit pops the extra padding byte everytime the received
frame has an odd length.

The equivalent fix is applied to the legacy driver.

Jira: ZEP-1098

Change-Id: Ib93cbcdcf11f3812961b6702f1b7fa621590aab2
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-12-02 12:40:58 +02:00
Juan Manuel Cruz a8bb46f0ec enc28j60: Fixes an issue reading/writing from spi
When the driver receives or transmits a frames with a length
that is multiple of MAX_BUFFER_LENGTH the last block would be
read/sent twice to spi because a missed calculation on
num_remaining.

The issue is fixed by controling when the remaining bytes are
written/read into the spi device and by setting the spi command
on each spi write/read attempt.

The fix is applied to the legacy driver as well.

Jira: ZEP-1098

Change-Id: Icb2195d74e34dcbcf0c70531da9886ca315bd78b
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-12-02 12:40:58 +02:00
Juan Manuel Cruz f63f2f4b97 enc28j60: The MAX_BUFFER_LENGTH is now declared in header.
The MAX_BUFFER_LENGTH symbols is now declared in the
eth_ecn28j60_priv.h file.

The legacy driver does not need this declaration here anymore.

Change-Id: I396fe92dbf5679c64183e25fa8b8d342c7f30dae
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-12-02 12:40:58 +02:00
Jukka Rissanen aabd839213 net: ieee802154: MAC address needs to be stored in big endian format
The upper IP stack uses the MAC address to construct the IPv6
address in SLAAC. Because of this the MAC needs to be stored
in big-endian format so that it can be used directly as is.

Change-Id: Ib31da56307017b4284031328772d4cb51d84fa23
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:57 +02:00
Tomasz Bursztyka 11a1d9ef32 drivers: ieee802154: Make uart pipe driver tx one fragment only
Let's not count the whole buffer length but only the very first frag's.
Up to L2 radio strategy to loop on every fragments and call tx for each.
(once sent, it deletes the fragment, so next fragment is always
buf->frags).

Change-Id: I94130fedfbecffdf62286bcb7f10563c776a255e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka 0f2164cb5a drivers: ieee802154: Make CC2520 ready to tx only one fragment
The given buffer can come with many fragments, but it's not up to the
hardware driver to send all of these but only the first in the list.
The overall fragments send procedure is handled in l2 level where the
radio transmission strategy loops over the list of framents and send
them one by one relevantly.

Change-Id: Ia7ae42ab4e9f8efb83bf07de6791918059b1e1c9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka 1cd4190b2f drivers: ieee802154: cc2520: do not recalibrate rx after tx
As we use STXONCCA, RX will be stopped and reinstated afterwards.
We would be using STXON, since FRMCTRL1_SET_RXENMASK_ON_TX bit is set,
behavior would be the same.

Recalibrating the RX will uselessly abort any received frames before TX
or right after RX got reinstated. So, let's not do that and trust that
RX is anyway properly calibrated after TX.

Change-Id: Iac4fa03a175f8d139c1fc821de01caab1ec86e6b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Jukka Rissanen ded457d5fa slip: Fix hexdump print
The fragment count value was incorrectly printed. All
the values > 9 had their last digit chopped off.

Change-Id: I8304b8047baa97995c3927809e4616653c87928b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:54 +02:00
Jukka Rissanen 5f3f331d48 net: Adapt to new behavior of net_buf_frag_add v2
This change is related to patch called
"net: Adapt to new behavior of net_buf_frag_add"

This version removes extra net_nbuf_unref() from
the code. The unref was done because net_buf_frag_del()
did not remove the double ref from the list element.

Because of the other patch, the list does not have
double ref any more, so we need to remove the extra
unref in couple of extra places.

Change-Id: If90e01c24b9b4e68afbfa283850d2a1ecb3065ed
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:54 +02:00
Andrei Emeltchenko 68e7037104 ieee802154: Correct error logging for cc2520 driver
Change DBG to ERR for error cases to get errors when only errors are
selected.

Change-Id: I51fd15900b1efb96d5dff36367afcdf380f11b88
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:52 +02:00
Andrei Emeltchenko daefa3d979 ieee802154: Add log domain for CC2520 driver
This prepends logs instead of [general] with [cc2520].

Change-Id: I148159a451981fbe3da638732f0e97900f76bc58
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:52 +02:00
Jukka Rissanen a559ad37c2 eth: enc28j60_legacy: Make driver config_info structure const.
Change-Id: Ic3aac209024bd9a6e8456b228705b39e88179b01
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:51 +02:00
Ravi kumar Veeramally c90e0ae58c net: Fix slip compilation issue with debug option enabled
Slip context parameter is not used in hexdump and in few places
it is not defined. So CONFIG_SLIP_DEBUG=y throws errors.

Change-Id: I73ca26b7d5cd7c3cd532462b5300e25bbdac9511
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:51 +02:00
Vinicius Costa Gomes 09b2bb05d0 drivers/slip: Fix circular dependency on NET_SLIP
Fixes this warning:

warning: (NET_SLIP_TUN && NET_SLIP_TAP && NET_SLIP_TUN && NET_SLIP_TAP) selects SLIP which has unmet direct dependencies (NET_SLIP)

Change-Id: Ic51f8403a4de19f90ba4dcdca93877d51dabf787
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00
Juan Manuel Cruz Alcaraz 8d6206c9be enc28j60: Adapt driver for native IP stack
Jira: ZEP-859

Change-Id: I7a073168a2bfba95291e43b227ffb6bfea1f5692
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2016-12-02 12:40:50 +02:00
Tomasz Bursztyka b49d6246b3 net: drivers: slip: Let's cleanup a bit for better readability
Change-Id: I50fef5bb607da600f0c878066312d4b7b2d71d58
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:50 +02:00
Tomasz Bursztyka 37d0958321 net: driver: SLIP does not need to store ll reserve at any time
ll_reserve is given through each buffer to be sent, it is therefore easy
to get it from there.

Change-Id: I8b52fe1b72065f5f58275f939253942f7db1f136
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:50 +02:00
Tomasz Bursztyka 9c70e1ca06 net: drivers: Slip can get the MTU set on it's interface
No need to store the mtu locally as the network interface already holds
it.

Change-Id: I4a1c3d164eefa28622dcb6cd510a66a825c3d9fb
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:50 +02:00
Tomasz Bursztyka 076235c23b net: drivers: SLIP should not reserve anything while receiving
Link Layer reserved space will be handled by relevant L2 layer.

Change-Id: I8e45119adb4de84ba321cad444c11bedef4415e8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:49 +02:00
Tomasz Bursztyka 18601fedb0 drivers: cc2520: Fix LQI computation and generalize it
LQI is actually not provided as is, but should be computed from an
abstract correlation factor. See Section 20.6.

LQI is provided the same way as Linux does, so it can push it everytime
into the buffer.

Change-Id: I5de318db2c2581d7482cc16e41dc601130753a62
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:47 +02:00
Tomasz Bursztyka cf9dcd3d5b drivers: cc2520: Fix 80 chars lenght limit
Fixing 80 chars limit by removing length computation:
We can count the FCS as part of the received length, even if AUTOCRC is
on. L2 layer is able to parse this out.

Change-Id: I3c824ed95d177570a07d04784798e14f5979c96b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:47 +02:00
Andrei Emeltchenko b41457bc5a ieee802154_cc2520: Fix compiler warning with strict aliasing
Fixes compiler warning with strict-aliasing rules shown below.

 ...
CC drivers/ieee802154/ieee802154_cc2520.o
drivers/ieee802154/ieee802154_cc2520.c: In function 'get_mac':
drivers/ieee802154/ieee802154_cc2520.c:290:42: warning: dereferencing
type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
...

Change-Id: Idb0522e4d2207932c9335db1ca12961a5093b48c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:46 +02:00
Andrei Emeltchenko 7889ebaf5e net: Add L2 RAW channel hidden option
L2 RAW channel allows to use some functions of IP stack for RAW access
of network drivers. It is hidden from user and is selected by 2520 raw
driver.

Change-Id: I91dd09803052072dfddb7989d9d67c3a5840f89e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:46 +02:00
Andrei Emeltchenko ca2cc81d7a net: Add TI_CC2520 RAW driver
Add TI CC2520 driver allowing RAW access to radio interface similar
way Bluetooth user channel works. This makes possible to handle radio
channel inside external 802.15.4 stacks, for example export it over USB
and handle in Linux.

Change-Id: I61bb4c8b998ff1e47dc65427ac471f04ec8fea63
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:46 +02:00
Andrei Emeltchenko d6155e0cf9 ieee802154_cc2520: Correct debug output
Change-Id: I52979eb6661aac62eea875f088972d472f46ef81
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:45 +02:00
Andrei Emeltchenko b85b27eab2 net: Do not source contiki headers always
Source contiki headers only for legacy driver

Change-Id: I356fd65ce9a4ee144c29eed1b51f2f0175315c1c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:45 +02:00
Andrei Emeltchenko b2a478b935 net: cc2520: Fix setting proper IEEE 802.15.4 address
The bug was introduced by commit ID
a136a2587752cca256950b0efd5567ca29117d11

Which led to write junk as an address into cc2520 and thus made the
chip filtering out all unicast packet (as the incoming address never
matched)

Change-Id: I72009e795039f2059177a5b37a4bcf5d9717d65d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:45 +02:00
Tomasz Bursztyka 4b7309c751 net: cc2520: Let's provide ll addr in LE already
As it used directly as the ieee addr.

Propre endianess will have to be solved once this stack will be ported
to other arch than x86.

Change-Id: Ie556fabbd99cc5559025c8392d2f699facb007fa
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:28 +02:00
Tomasz Bursztyka 6790484ce2 net: ieee802154: Auto ACK and CRC are always on
We have no use of configuring cc2520, at built time at least, in
promiscuous mode. So let's get rid of these options for the new driver.

Change-Id: I17611c43bc7ba7961831beaa47cc4e2371f8de61
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:27 +02:00
Andrei Emeltchenko 29e3bcfcde ieee802154_cc2520: Fix byte order swap for long address
This fixes bug setting incorrect long ieee802154 address and also
print address in BE byte order the same way as for Linux.

Change-Id: I774301e992372588dffa6ce5964fb119642a0a0d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally e09b79f858 net: Fix slip multipackets reception
Multipackets support not handled perfectly and breaks regular
flow on some occasions. So remove this support and have to
implement properly.

Change-Id: I1b72c66479c3516df6e6e93998edff1260eb839d
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Jukka Rissanen 846bb62521 slip: Fix debug printing
Print the link layer header in different color so that the
actual IP payload in packets are easier to see. Also the
link layer header of the first packet was not printed.

Change-Id: I99699d378ae28d6d90c683c646c904c926b7dd06
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Tomasz Bursztyka fc0e6497af net: drivers: Add a fake ieee802154 radio driver for qemu
This driver is used for testing on Qemu where all "radio transmission"
will go through a pipe between 2 Qemus.

Change-Id: I5b4e75de82a98eb730ef9c70b460b4b60c0a60c3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:24 +02:00
Tomasz Bursztyka 6b0732f632 net: drivers: Normalize ieee802154 Kconfig
Indent with tabs, no spaces.

Change-Id: Idee4167039964c253cf280cced787b05873f2780
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:24 +02:00
Tomasz Bursztyka 73d8c7c443 net: drivers: cc2520 ieee802154 drivers select relevant options
If no IP stack is seleceted, selecting one of the 2 cc2520 driver will
automatically select the relevant stack.

Change-Id: Icca22da190dc790ce6d302e14c45732f902e02ae
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:24 +02:00
Tomasz Bursztyka b283640f10 net: drivers: ieee802154: sys_log is needed on legacy driver
Or the build will not go through.

Change-Id: I48f5f8661c4100a76e4624ea64d383055327e2a7
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:23 +02:00
Vinicius Costa Gomes 9d146adf9a drivers/slip: Fix warnings when TAP support is disabled
When only the dummy frame format is enabled, some variables are left
unused, causing some warnings.

Change-Id: Ic7bc5560a9fcb573e715c2cc29f308cec5214f64
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:23 +02:00
Tomasz Bursztyka 3e0c1ff876 drivers: cc2520: Raise Rx stack size
640 bytes seems too short, raising to 800 bytes.

Change-Id: I8c3418787939369e24fe47c23b0558c36f05af2c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:22 +02:00
Tomasz Bursztyka 434ba9311c net: ieee802154: Logging header should be loaded first
net_core.h is loading sys_log.h as well, so we need to be
first in order to setup some local definitions.

Change-Id: Ife482bd21e314aa5a5e88433eb8f9a560f9d53a6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:21 +02:00
Jukka Rissanen a4f56b6fa8 net: Fix compilation if IPv4 is disabled
Change-Id: I4ef4ce1c418361ce01ceb77204c830258a163683
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Tomasz Bursztyka 4c0d9bcf9a drivers: cc2520: Add a new IP stack ready adaptation of CC2520 driver
It's basically a copy/paste of original driver,
using native IP stack API.

This is meant to avoid cluttering the original driver
code with #ifdef, and in future it will help removing
the old driver as well.

Change-Id: I67d974ad7440d258583a5c7c6c7160e99210808c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka ed6ad65427 drivers: cc2520: Make current driver for legacy stack only
Another driver will be made for native IP stack. This is meant
to avoid cluttering the code with #ifdef all over the place.
Instead driver will be transparently selected at built time.

Change-Id: I283f1194fece9357425b87794b5cb51938ca80d3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka 3560f58293 net: L2 might need private data per-interface
Allocate the right amount of space for L2's context.

Change-Id: Ia2f4f4162334e9e9c26dc95230abdfde5986e052
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Jukka Rissanen 9d5b0d651c slip: Do not send ethernet header if MTU is large enough
No need to partition the data if MTU is large enough and
data can be sent in one frame.

Change-Id: I8ba0f5030ed1e2c1341c7e2dd409ba636b1a9a4c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:15 +02:00
Tomasz Bursztyka b8e3415264 net: Let's use inline function for type checking for net_nbuf
Using macros does not let the compiler verifying about the type we are
providing, which usually give an error easier to understand.
Also, this will let the compiler deciding how to actually optimize
(inline or not) the code.

Change-Id: Iba49590b620ef0a1bd0ed5621453524fcfea747c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:13 +02:00
Jukka Rissanen a7e75ba81b slip: Setup fragments properly if MTU is bigger than frag size
If the MTU is bigger than fragment size, we must leave the
fragment link layer header empty so that the received data
count does not get wrong.

Change-Id: I0ed562f39bfbfb559885baa6d774c0383b2228b2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen eca54f0cd7 slip: Do not try to unref a null pointer
There is no harm for doing so but debug prints will look
weird in this case.

Change-Id: I48b6953d07a58bc952fe961cf1db846740dadc50
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen c06c5b8dcb slip: Network stack needs to be up before sending data to it
There will be a crash if network device sends data to network
stack before it is ready to receive such data.

Change-Id: I1a32485faba2972909262c4305fb465b6cb87f07
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen 33a23332b8 slip: Fix the debug print
The code was using NET_DBG() which is not really available
for the slip/tap driver.

Change-Id: I64cedd5fbfb54fdb80d606cf3199312c8871246f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen 682b303a47 net: Write ethernet header in pdu when using slip and tap
Change-Id: Ic5901b97356528589a7e244da8e366afaa1db6f6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen 7bfffc3bc4 net: Use debugging net_buf unref function
Easier to see buffer leaks using this variant.

Change-Id: Ibdc8d73133cab4822451104fcd5742e4f1e20e42
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Tomasz Bursztyka 82a6e963f4 net: Removing capabilities from net_if api
As there is a L2 in the middle, there is no need for
net_if to provide such information.

Change-Id: I58a35d4d124cd8a67026f32e71713ef06f43b7c5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:06 +02:00
Tomasz Bursztyka 4090b4c01f net: Add an L2 layer
Net core then does not know anything about l2 related logic.
For instance ARP is used in ethernet l2 API and nowhere else.
This will be helpful when adding different technologies altogether.

Currently, only SLIP driver is enabled to use relevant l2 layer.

Change-Id: I03c93326321028d04222733ca4083e3c6b785202
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:06 +02:00
Tomasz Bursztyka b19f26bbbc slip: Fix compiler warnings
2 warnings happens when CONFIG_SLIP_DEBUG is set, thus fixing it.

Change-Id: I032d7481942e86911764da35cdd6f7b8e05cdeaa
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:06 +02:00
Jukka Rissanen d16380457b slip: Support TAP functionality
If CONFIG_SLIP_TAP is defined, then ethernet link layer header is
added before the packet.

Change-Id: I3d266017f85683999d3c67de49b75b60686d7ba7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:04 +02:00
Jukka Rissanen 5729d1c461 net: Renamed network data receive function
Renamed net_recv() to net_recv_data() so that the more generic
name can be used by applications. The net_recv_data() is only
meant to be used when L2 layer feeds data into L3 (IP) layer.

Change-Id: Iba155d51f81e3b99964fa916fe87a05a8bf8766a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:03 +02:00
Jukka Rissanen d24f673248 net: Receive IPv4 packet
Check if we have received IPv4 packet and call a handler
function to process it.

Change-Id: I9f9e5f0888d2c3b91401c98f4925647ddce09962
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:02 +02:00
Jukka Rissanen 2ddb7ce42e slip: Add driver for host to qemu connectivity
The SLIP driver is using UART pipe driver to communicate with
host when Zephyr is running in Qemu. Currently this is only
used by networking sub-system when testing the networking
stack.

Change-Id: I432b4136670766a7fc190f146057924c266f9bea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Baohong Liu 313700e26f drivers: sensor: use unified kernel API
Change-Id: I5d51e65105f9dee3d5eb49c60b9e5636ebd14df6
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-30 23:54:58 +00:00
Baohong Liu fa2d38e395 drivers: console: use unified kernel API
Change-Id: I2184f0565a9a4f2ebfdff1f57afc22ce36fe0646
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-30 23:49:04 +00:00
Anas Nashif 36e8fc5c05 drivers: lcd: use unified kernel APIs
Change-Id: Ie0d6f6e22646b23883f6b940812f93bba1789828
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-30 21:45:21 +00:00
Vinayak Chettimada 6276ca68c8 drivers: timer: replace deprecated interface in nrf_rtc_timer
Rename sys_cycle_get_32 to k_cycle_get_32 in nrf_rtc_timer.

Change-id: I50af876b254dc5bc3dbb2ccfdf27d33bc4b8d5e5
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-11-30 19:21:54 +00:00
Vinayak Chettimada 883f9c39f7 drivers: timer: Fix missing sys_clock_disable in nrf_rtc_timer
Change-id: Ia453b8484050c8431d2f793e8f5726684afa21f4
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-11-30 17:25:48 +00:00
Vincenzo Frascino b41c0159a8 watchdog: Refactor main Kconfig file
This patch refactors the main Kconfig file in order to align it with the
Zephyr code style and to make sure that each Kconfig configuration
portion is easily identifiable.

Change-Id: Ib226aaa9a98e9b08a47d9d1c329f18f4f6936620
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-30 17:25:15 +00:00
Vincenzo Frascino 73ee7e2d1c counter: Fix interface
With the current interface if multiple counters/timers are present in
the system, it is not possible to select from which one to read the
current value.

This patch fixes the behavior.

Change-Id: Id1ae1f2330e98d078f755c0b81c3b176e90b8389
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-30 14:39:10 +00:00
Vincenzo Frascino f0fd6c2634 counter: Refactor main Kconfig file
This patch refactors the main Kconfig file in order to align it with the
Zephyr code style and to make sure that each Kconfig configuration
portion is easily identifiable.

Change-Id: Iba83be8ae154df4b29ff423b4c3cc97a78c93e00
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-30 14:39:10 +00:00
Qiu Peiyang 3763487575 sensor: fix typo in Kconfig
Change-Id: I0fc7e0f66ba994f42a04684e4862fc3218ddd075
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-11-29 12:59:35 +00:00
Anas Nashif 247a4509ce drivers: nrf timer: remove unused variable
retval is not being initialised or set.

Change-Id: Iaab4f1acbb009b1fb9cdbc4b3c29ffb696dc8615
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-27 22:36:02 -05:00
Vinayak Chettimada a100ada866 drivers: timer: nRF SoC Series RTC system clock implementation
The nRF5x series SoCs do not implement systick, hence we disable
CORTEX_M_SYSTICK.
Instead, use nRF SoC Series NRF_RTC1 for system clock interfaces.
The kernel system clock interface is implemented using the low
power real time counter NRF_RTC1. NRF_RTC0 is used by the BLE
controller.

In addition, cleanup nRF5x series defconfig to be consistent.

Jira: ZEP-742
Jira: ZEP-1308
Jira: ZEP-1315

Change-id: I0f6cc1836fe0820a65f2cbb02cf5ae7e9eb92e1d
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-27 19:39:27 +00:00
Anas Nashif 92c5f91413 arm: systick: Some SoCs do not have systick
Make the systick feature optional that can be selected by the SoC.

Change-Id: I4a405640b84daecc17fc1882743d3cafb78ff861
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-27 19:39:26 +00:00
Marcus Shawcroft 7df7862749 sensor/bmc150: Limit name space, add static.
Change-Id: Ifd9ec1aec4e6486c14121b30bcd009b61456276d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft c3b2861572 sensor/bmc150: Fix filename in comment.
Change-Id: I0a5aaf0f3633034fabef351dc419899f9bb9c8fd
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 91bc741255 sensor/bmc150: Fix logging configuration.
Change-Id: Iae06066b568f51c8b63f00e973a411dcbb396dac
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 40d2572d12 sensor/lsm9ds0_gyro: Limit name space, add static.
Change-Id: Ifff624a2c0f619d7bb3e005b4e52b4602730a66d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 8f92c5462e sensor/lsm9ds0_gyro: Fix filename in comment.
Change-Id: I6de8806fbe6ec25c83042bc52274fd91a76ae280
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 9048cb91d0 sensor/lsm9ds0_gyro: Fix logging configuration.
Change-Id: I332d9515e61d83f243f49353d4b67f854fec7f2e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft 744e438a33 sensor/lsm9ds0_mfd: Fix logging configuration.
Change-Id: I925a683e0ac961f05065b25782fc30d007e1aba6
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft aba867d5e9 sensor/fxos8700: Switch to generic SYS_LOG_SENSOR_LEVEL
Change-Id: I21607836b2fe0cd1cd62759bed499af70a93e1be
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft f112e8e9bc sensor/lps25hb: Limit name space add static.
Change-Id: I707fd3666f27a982f9b4ef0facf7a3a211db8914
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 5fe0a759ee sensor/lps25hb: Fix filename in comment.
Change-Id: Ie5529544248d408cb314be83a609b8d1d9ecaaa5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 052a67f88d sensor: Remove unsued LPS25HB_SYS_LOG_LEVEL config.
Change-Id: I5af84fd420a9c50f943938faf7ed966385c19f08
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 14cd63a92a sensor/lsm6ds0: Limit name space, add static.
Change-Id: I227865ebbb6bf66b63694639dede3f0276c4cf22
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 9dc050d15e sensor/lsm6ds0: Fix filename in comment.
Change-Id: I50df25c209c322f404e7a78c5df57c2c7d75964b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft 79a4d35043 sensor: Remove unsued LSM6DS0_SYS_LOG_LEVEL config.
Change-Id: I7b994b33a1202cbc75a8ce5afd0385a45627f45d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:26:53 +00:00
James Fagan 7cea08d5f1 aio: Configuration issue in aio driver
The reference and polarity fields of the config struct which is passed
to qm_set_config are never cleared, meaning the wrong configuration
may be written if aio_set_config is called for different sets of pins
in the same program.

This patch clears these fields in aio_cmp_disable to prevent such an
issue.

Change-Id: I8feabae1f3d9fa4c7260d94c1ec919ef2fb84bfb
Signed-off-by: James Fagan <james.p.fagan@intel.com>
2016-11-23 00:16:22 +00:00
Tomasz Bursztyka dc7193373b clock_control: NRF5 Kconfig option should be available only on NRF5
Change-Id: If6ba2f5a03967ca2ddca8d4bc211bc0c55ae0312
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-11-22 17:00:46 +00:00
Tomasz Bursztyka b7d0784552 pinmux: nucleo_f103: Fix an 80 chars limit issue
Change-Id: Ib59f818ff9687ca4487ad8023c9f9a4e0f5ca6be
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-11-22 17:00:45 +00:00
Vincenzo Frascino 86add71a86 clock_control: Cleanup stm32f10x driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the containing file scope declarations.

Change-Id: Idaaa0d705a31bc69cdf7e576e303f581d3d0bd5f
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-19 01:58:55 +00:00
Vincenzo Frascino b6b35f6113 clock_control: Cleanup stm32f4x driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the containing file scope declarations.

Change-Id: I14651826724c014cc71d62ab6cab03c668c578c0
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-19 01:58:54 +00:00
Vincenzo Frascino 9c1bb2b2b9 clock_control: Cleanup quark_se driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the containing file scope declarations.

Change-Id: I6d48d2eaf6ffd5fa28b37e1d3ca2d467705110f3
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-19 01:58:54 +00:00
Vincenzo Frascino dc1ddf9c1a clock_control: Cleanup nrf5 clock_control driver
This patch removes redundant "depends on" from Kconfig.

Change-Id: I13d7556faa4751d2da149d458340bcdf29afa2ca
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-19 01:58:53 +00:00
Vincenzo Frascino d6964951df clock_control: Cleanup main Kconfig
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.

Change-Id: Ic9e2fd935417fa40127bddeba4660109332087ff
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-19 01:58:53 +00:00
Anas Nashif 9f884155ab Merge "Merge bluetooth branch into master" 2016-11-19 01:52:15 +00:00
Juan Manuel Cruz 3e1d001f9b enc28j60: Fixes an issue reading/writing long frames from SPI
Jira: ZEP-1302
Change-Id: Ia58d51aee14281aaeb2f8e85fbbf8c250eae8e06
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-11-18 23:19:21 +00:00
Vincenzo Frascino 9468f8183d aio: Cleanup AIO comparator driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the containing file scope declarations.

Change-Id: I03326a800392cffda00b47949981b7e6d119b90f
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-18 19:00:23 +00:00
Paul Sokolovsky 6b2a1af1cd pinmux: Make default init priority be between GPIO's prio and device prio.
Pinmux driver almost certainly should be initialized before the
rest of hardware devices (which may need specific pins already
configured for them), and usually after generic GPIO drivers.
Thus, its priority should be between KERNEL_INIT_PRIORITY_DEFAULT
(default 40) and KERNEL_INIT_PRIORITY_DEVICE (default 50). Thus,
we set PINMUX_INIT_PRIORITY to 45.

There are exceptions to the rule above for particular boards. For
example, BOARD=galileo has GPIO and pinmuxer on I2C bus and thus
overrides PINMUX_INIT_PRIORITY to be much higher. Note that while
PINMUX_INIT_PRIORITY was defined previously (at 60), it was used
only for galileo, which overrides it anyway.

This fix was prompted by investigation why eth_ksdk driver was
non-functional after kernel priorities re-hashing: both eth_ksdk
and pinmux used the same priority, and eth_ksdk happened to run
before pinmux. While bumping eth_ksdk priority would help in the
particular case, the same would likely reoccur with other drivers
like I2C, SPI, etc.

Change-Id: Ie5ca3135c1ee2fe8d9cf48d5c12e62eac63487f7
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2016-11-18 16:43:45 +00:00
Johan Hedberg 2469bd6f87 Bluetooth: Use convenience macros for timeout durations
Using the K_* macros makes it easier to read what exactly the various
timeouts are.

Change-Id: Ia405d3760b8e600af7e33a7221ef6ec717708973
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-18 07:47:50 +02:00
Sergio Rodriguez 6b04e0669a drivers: gpio_dw: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity

Coverity-CID: 151978

Change-Id: I93ec3319a3f18d564c961a5cbd9dcc9c60efbeb7
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-18 02:04:36 +00:00
Sergio Rodriguez cd63c74bbd drivers: gpio_atmel: Fix erronous if statement
The GPIO_INT_ACTIVE_LOW value is  zero so the mask assignement is
never executed. Using the bit complement GPIO_INT_ACTIVE_HIGH the
proper mask is assigned

This issue was reported by Coverity

Coverity-CID: 151966

Change-Id: Ibc7d2e4c3ebee249b5ab9719f8177cc14c0d1d33
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-18 02:04:20 +00:00
Baohong Liu b58b1bbc9c drivers: cc2520: fix variable type mismatching issue
The variable type mismatching was caught by LLVM.

Jira: ZEP-1179

Change-Id: If26c881d207a6cedc52b7589c5d7ebb2040c7ab7
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-18 00:21:32 +00:00
Baohong Liu fb83ea9cc6 drivers: rtc: fix enum type mismatching issue
The enum type mismatching was caught by LLVM.

Jira: ZEP-1179

Change-Id: I50b68e201ef6fb18a02eeda2a2e7548dad3f358c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-17 23:39:25 +00:00
Sergio Rodriguez 6c393fa393 drivers: gpio: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity (CID 150821).

Change-Id: I6c0e9fe405cbd3e35454a81754fa0b1c721691f0
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:28 +00:00
Sergio Rodriguez 23a0f6c918 drivers: gpio_ss: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity

Coverity-CID: 151833

Change-Id: Ie952d6f50c0383d5631325b69e8e8b234c67c4b8
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:24 +00:00
Sergio Rodriguez 97c5020079 drivers: gpio_k64: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity

Coverity-CID: 151834

Change-Id: I033e368b2e91d888f2e8a797490df757513c3906
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:19 +00:00
Vincenzo Frascino f880c250dd adc: Cleanup ti 108s102 adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: I0692b389da7f4bf591b5e33f7481bf3dcbbf9801
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino 95f06a5657 adc: Cleanup qmsi ss adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: I28e7daef19359759afb09cd196f659a81c758ea1
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino 9192e55ff4 adc: Cleanup qmsi adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: I12c29f83e5e8a7eb51880d481da17666764b2c2b
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino 0dfab90d30 adc: Cleanup DW adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: Ib05943b53b6863b5b44848ecb2199b7e99d24139
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino c3b54339da adc: Cleanup main Kconfig
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.

Change-Id: I46a156581cdf79d0ba8f0030ce7b595469db1bcb
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino add1b55dca gpio: Cleanup DW gpio driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the gpio_dw_isr declaration.
* Adds guards to the header files.

Change-Id: I1ae70868f0bda97891cbeb494e5efba1bd537aa1
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:01 +00:00
Vincenzo Frascino 0ff548a0e0 gpio: Cleanup Kconfig for K64F
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.

Change-Id: I4c8df0999f92a834d4023ce5856a2a6c39797c00
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:01 +00:00
Vincenzo Frascino 2a8eb46f5c gpio: Cleanup Kconfig dependancy for nRF5X support
This patch removes a redundant "depends on" from the gpio Kconfig for
nRF5X family.

Change-Id: I28ac15b58839e05f47ade81bef66a03a0a44bebd
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:00 +00:00
Vincenzo Frascino 9e7fec0ca4 gpio: Cleanup Atmel SAM3 gpio driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the gpio_sam3_init declaration.

Change-Id: If5c8a1822d6c116ea34d0f220f3e5fa359b6fa18
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:00 +00:00
Iván Briano 2e6e0a7c38 drivers spi_ss: Fix setting of wrong config for SPI 1
Jira: ZEP-1287

Change-Id: I3678631aa5843e769b8e1611734767fa6264b9af
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-16 14:05:54 +00:00
Vincenzo Frascino f3a9241045 console: Fix unreachable code condition
This patch fixes an unreachable code condition in the uart_console
driver.

If UART_CONSOLE_DEBUG_SERVER_HOOKS was not defined
handled_by_debug_server in console_out was always 0.

This issue was reported by Coverity (CID 131627).

Change-Id: I4376c3e5b3e68220218df6aabd91b6a8900ca31f
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 13:30:11 +00:00
Vincenzo Frascino ceca10828a sensor: Fix Unchecked return value in bma280 driver
This patch fixes two "Unchecked return value" conditions into the bma280
driver.

The issue was reported by Coverity (CID 151953).

Change-Id: I2e595b67619411594cec527f358f6c3d3d034550
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 13:30:11 +00:00
Sergio Rodriguez 39b06e676f drivers: pwm: Fix uninitialized pointer
This fixes an uninitialized pointer being pass and evaluated by
a subsequent function

This issue was reported by Coverity (CID 150824)

Change-Id: If1f636a44cc675b56e426b1de85895b74ba7105e
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-16 12:37:07 +00:00
Baohong Liu d6ba1c0c3e drivers: bmi160: fix variable type mismatching issue
The variable type mismatching was caught by LLVM.

Jira: ZEP-1179

Change-Id: I1193a946ea5814510e6c07668c5d05a5d91445a8
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-16 02:08:21 +00:00
Sergey Kiselev 2e10266975 sensors: bme280: fix typo in reading trimming parameters
Change-Id: I32e72c2845bd06b10585ac8048f67ac754c2a6d6
Signed-off-by: Sergey Kiselev <sergey.kiselev@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-16 01:37:54 +00:00
Vincenzo Frascino 34b7fbfca7 sensor: Fix Unchecked return value issues in bme280 driver
This patch fixes unchecked return value conditions in the bme280
driver.

This issue was reported by Coverity (CID 151961, 151959, 151955).

Change-Id: I3a2dfbabd41ae52b00fa512a40e00c2e36c3b5ca
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 00:42:22 +00:00
Vincenzo Frascino 5912d7abe7 sensor: Fix less-than-zero comparison in bmi160 driver
This patch fixes a less-than-zero comparison of an unsigned value
condition present in bmi160 driver.

This issue was reported by Coverity (CID 152002, 152003).

Change-Id: I703066519652ac1ecdd9ddf7e97ec7dcbe2a9e27
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 00:42:21 +00:00
Anas Nashif 2367df8d59 drivers: update ipm driver to use unified kernel
Move away from legacy APIs and use unified kenrel instead.

Change-Id: Icae86beec66df1b041405cbe3455913630fc8ad1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-13 13:53:53 +00:00
Anas Nashif 55273b0c76 drivers: sensor: use unified timer struct name in header
Change-Id: I2d2a1689d66ed4a9ab1ce1ed5bb70c8b65f7df31
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-13 13:53:52 +00:00
Anas Nashif cf054a2665 drivers: gpio_sch: use unified kernel APIS
Use unified kernel APIs and align syntax after function name changes.

Change-Id: I028f4faeaf33e28197d5f705063459188272027d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-13 13:53:52 +00:00
Johan Hedberg 1e20e8dc04 Bluetooth: Fix left-over usage of TICKS_NONE and TICKS_UNLIMITED
Switch left-over usage of TICKS_NONE and TICKS_UNLIMITED to the new
unified kernel counterparts K_NO_WAIT and K_FOREVER.

Change-Id: I2f2a16360e816f9f8791eb216deb3c70b8cc87df
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-12 19:27:34 +02:00
Johan Hedberg 79f020be54 Bluetooth: Flag NBLE as deprecated
The NBLE driver is now deprecated and will be removed in a future
Zephyr version.

Change-Id: I50753f8cf8566ac1e4e73df480c96253c199e6a7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-12 16:18:55 +02:00
Benjamin Walsh f6ca7de09c kernel/arch: consolidate tTCS and TNANO definitions
There was a lot of duplication between architectures for the definition
of threads and the "nanokernel" guts. These have been consolidated.

Now, a common file kernel/unified/include/kernel_structs.h holds the
common definitions. Architectures provide two files to complement it:
kernel_arch_data.h and kernel_arch_func.h. The first one contains at
least the struct _thread_arch and struct _kernel_arch data structures,
as well as the struct _callee_saved and struct _caller_saved register
layouts. The second file contains anything that needs what is provided
by the common stuff in kernel_structs.h. Those two files are only meant
to be included in kernel_structs.h in very specific locations.

The thread data structure has been separated into three major parts:
common struct _thread_base and struct k_thread, and arch-specific struct
_thread_arch. The first and third ones are included in the second.

The struct s_NANO data structure has been split into two: common struct
_kernel and arch-specific struct _kernel_arch. The latter is included in
the former.

Offsets files have also changed: nano_offsets.h has been renamed
kernel_offsets.h and is still included by the arch-specific offsets.c.
Also, since the thread and kernel data structures are now made of
sub-structures, offsets have to be added to make up the full offset.
Some of these additions have been consolidated in shorter symbols,
available from kernel/unified/include/offsets_short.h, which includes an
arch-specific offsets_arch_short.h. Most of the code include
offsets_short.h now instead of offsets.h.

Change-Id: I084645cb7e6db8db69aeaaf162963fe157045d5a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-12 07:04:52 -05:00
Johan Hedberg 488f72dd80 drivers: console: Fix compilation error in uart_console.c
Fix compilation error when CONFIG_USB_UART_CONSOLE is not enabled:

drivers/console/uart_console.c: In function 'uart_console_init':
drivers/console/uart_console.c:497:12: error: unused variable 'dtr' [-Werror=unused-variable]
  uint32_t  dtr = 0;

Change-Id: I592724150f86199f6a57354c3246197db2ac7a01
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-12 12:49:53 +02:00
Jithu Joseph fca0add22b console : usb: USB UART console output support
Add support for console output via the USB UART.
Note that console input via the USB UART doesnt work.

Adds a simulated poll method for UART interface exposed by USB.

Jira : ZEP-775

Change-Id: I357827ea52c027eb000baed80225f422df1f3358
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-12 01:39:30 +00:00
Baohong Liu a282872c78 drivers: spi_flash: add erase boundary check and correct an error
Add spi flash erase boundary check. The erase boundary must be
4K-aligned. So, the flash chip will round down an non-4K aligned
address to the nearest 4K boundary automatically. As a result of
this, the erase area will start from a different address (if the
API caller specifies an non-4K alighed address), even though the
size of the erased area is the same as what is specified by the
API caller. Let's add a boundary check to make sure the starting
address (from the API caller) is 4K aligned.

Correct an error in the highest address check. Because of the
error, the erase api call will fail if the flash's highest
address byte is involved.

Jira: ZEP-1277 ZEP-1278

Change-Id: I8b6be57cc8f636f94e5fe67d5a492841a8555005
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-12 01:37:00 +00:00
Iván Briano b190bd4da2 adc_qmsi_ss: Add power management support to driver
Add the device_ctrl hook to the ADC driver of the Sensor Subsystem,
using the QMSI APIs to save and restore the driver's context.

Jira: ZEP-667

Change-Id: I8b89a875d8185cc4db3c4bfc30ef0f39c6589df1
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-11 23:33:21 +00:00
JuanX Solano Menacho a5fce7aa11 spi_qmsi_ss: Use qm_ss_spi_save/restore_context APIs
This commit updates the spi_qmsi_ss driver by adding save/restore
context functionality for power management, using the corresponsing
QMSI APIs.

Jira: ZEP-664

Change-Id: I9e62729f91c4808eb557d8a64c0f10955f5456f3
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-11 23:33:21 +00:00
JuanX Solano Menacho b4b612f1e4 i2c_qmsi_ss: Use qm_ss_i2c_save/restore_context APIs
This commit updates the i2c_qmsi_ss driver by adding save/restore
context functionality for power management, using the corresponsing
QMSI APIs.

Jira: ZEP-666

Change-Id: I36fb18b52edd4dac4c4b6cb98162adbca74800cb
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-11 23:33:20 +00:00
JuanX Solano Menacho 866d9c9c2d gpio_qmsi_ss: Use qm_ss_gpio_save/restore_context APIs
This commit updates the gpio_qmsi_ss driver by adding save/restore
context functionality for power management, using the corresponsing
QMSI APIs.

Jira: ZEP-665

Change-Id: I5d8b6050f5b099678b7e6d9144907ea2ce2dda4b
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-11 23:33:19 +00:00
Anas Nashif 3fe2575f0d drivers: sensors: use unified kernel threads
convert all sensor drivers to use threads and the unified kernel API and
remove all legacy APIs.

Change-Id: Ica43ea74ecbbf85273f718f182c413a9dcd8abc6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 21:00:19 +00:00
Anas Nashif 8910c228a2 sensors: use unified kernel APIs for kernel objects
move both semaphores and nano_work objects to unified kernel APIs.

Change-Id: Icca8a091063544c451e47201cd8e956b95010513
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-11 21:00:19 +00:00
Vincenzo Frascino bb1818a535 serial: Add driver for CMSDK (Cortex-M System Design Kit) APB UART
Add driver for CMSDK APB UART ports. The driver implements RX and TX
functionalities. Data transmission is implemented using polling and
interrupts. The driver default configuration for the port is to use
8bit data transmission, 1 stop bit, no parity control.

The driver exposes a public uart driver API and allows to register up
to five UART devices: from 'UART_0' to 'UART_4'. The driver performs
the required pinmux, the clock control configuration is left to the
platform.

The driver has been verified to work with the Hello World sample
application on a Beetle Board.

Jira: ZEP-1245
Change-Id: I5baf78b7659aae2a574d8e66205e6fd5eb579133
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-11 20:39:54 +00:00
Vincenzo Frascino 0e01c0c4a2 pinmux: Add support for "runtime" pinmux on ARM V2M Beetle
This patch adds the support for "runtime" pinmux on ARM V2M Beetle.

The GPIO controllers 2 and 3 are reserved and therefore not exposed
by this driver.

Jira: ZEP-1245
Change-Id: I9637f1a0d2bf6a757e1942160fb170165ffe6a0c
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-11 20:39:53 +00:00
Vincenzo Frascino c0c3e33e4a pinmux: Add support for ARM V2M Beetle Initialization
This patch adds the support for the board pinmux initialization on
ARM V2M Beetle.

The GPIO controllers 2 and 3 are reserved and therefore neither exposed
nor configured by this driver.

Jira: ZEP-1245
Change-Id: Id5499c5dd887c319730408eeb30f02eeed1c3699
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-11 20:39:53 +00:00
Vincenzo Frascino e36c04afe1 gpio: Add ARM CMSDK (Cortex-M System Design Kit) AHB GPIO driver
The driver is currently used only by the ARM Beetle platform.

Jira: ZEP-1245
Change-Id: I6611edd7486a3c6d82d66a9a96c5d4860dad1539
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-11 20:39:52 +00:00
Luiz Augusto von Dentz 6b2443e99b console: Fix warnings related to the use of deprecated APIs
This fixes the warnings related to the use of deprecated APIs
converting them to use the unified version.

Change-Id: I76d076de27ecdae4af46abf4baac68e2cc1313c0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-11 14:50:58 +02:00
Johan Hedberg effbe6743d Bluetooth: drivers/nble: Convert to unified work APIs
Start using the k_work and k_delayed_work APIs.

Change-Id: Iac0525a444c5c4e0f28db08844d7b28e17e905fc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 11:13:47 +02:00
Johan Hedberg 776b3e6871 Bluetooth: drivers/h5: Convert to unified work APIs
Switch to using k_work and k_delayed_work APIs.

Change-Id: I3be18132cc417607adaec0ad711256b94e314c38
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 11:10:00 +02:00
Johan Hedberg 5f5425f20a Bluetooth: drivers: Don't use deprecated NANOKERNEL init level
Don't use the deprecated NANOKERNEL init level. The only requirement
for Bluetooth drivers is for them to be registered before the
application main() runs, so POST_KERNEL should be good enough.

Change-Id: I02a8609bf63e9d608b802576214a2e76211b3965
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:50:47 +02:00
Johan Hedberg c78bfd9a98 Bluetooth: Use k_sleep() instead of deprecated fiber_sleep()
Use the unified kernel API k_sleep() instead of the deprecated
fiber_sleep().

Change-Id: I587d72ca5b53aacc02647b32c3ebceb1d7fe067e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:38:40 +02:00
Johan Hedberg 918a8e6bac Bluetooth: Use k_thread_spawn() instead of deprecated nano_fiber_start()
Switch to using the unified kernel k_thread_spawn() API instead of
nano_fiber_start().

Change-Id: I325cf467ae2a52c6aec8fc166397c323929e3013
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:38:40 +02:00
Johan Hedberg b0f0742b6e Bluetooth: Use k_yield() instead of deprecated fiber_yield()
Use the unified kernel API k_yield() instead of fiber_yield().

Change-Id: I8f52031f52f7ac8783033a51751dc22decdfa59a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 09:38:40 +02:00
Szymon Janc 2b16287286 Bluetooth: Use proper timeout defines for net_buf_get_timeout
Use defines from k_fifo intead of legacy API.

Change-Id: Ib8cf0d88240ef145da550b8cf83d2580e7140521
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 06:00:28 +00:00
Szymon Janc e2795499d8 Bluetooth: drivers: Use unified k_fifo API for FIFOs
Change-Id: Id2ef6f9a134e6471c59bf3baedccef219d7f12f6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg b64e0d4c51 Bluetooth: Kconfig: Remove redundant 'default n' declarations
All boolean options default to 'n' without the need to explicitly
state this. It's only the cases where we want 'default y' where we
need to state this.

Change-Id: I47dbda62462ea437a2423b8508ea2cc640a22e41
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg c583a9f43b Bluetooth: Kconfig: Restructure for a more logical hierarchy
Restructure the Bluetooth options more logically.

- Both host and controller are now behind the same high level
  CONFIG_BLUETOOTH.

- Selecting controller support disables other HCI driver selection, so
  the controller isn't in the same list as HCI drivers any more.

- Under the top-level there's a "Custom stack" option, which when
  enabled opens up the option of choosing CONFIG_NBLE.

There are various other cleanups and simplifications in this patch as
well, since splitting these up would have been fairly tricky while
making sure all test cases still build.

Change-Id: I5bb715cb9d20201cb8b72fbd149c8a09a4b2d7d2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Julien Delayen f540cbc5c5 power: Add ARC power states and update sample
Add Low Power States support to the power shim layer
and show the usage in the quark_se sample.

States are defined as follow:
- SYS_POWER_STATE_CPU_LPS: SS2 with LPSS enabled
- SYS_POWER_STATE_CPU_LPS_1: SS2 with LPSS disabled
- SYS_POWER_STATE_CPU_LPS_2: SS1 with LPSS disabled

Jira: ZEP-994

Change-Id: Ie4b93f6e539cb53fc035be00280b66b2cb0d9fea
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-11-11 03:28:54 +00:00
Sergio Rodriguez 3932dd98a7 drivers: usb: update to unified kernel
Change-Id: Ie0cb514f3d84f7f87a0cf3f3a477df5cf04886d4
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-11 02:48:20 +00:00
Baohong Liu 6a791a3286 drivers: spi: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I372bf24cf34b2f01a6487f4c50071fa40d6103ba
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 23:33:43 +00:00
Baohong Liu f1a1fe0b19 drivers: aio: update to unified kernel
Change the included kernel header file from nanokernel.h to
kernel.h

Change-Id: Ie58174524880ec933191ee1fd46e6c1ba4cd0cc9
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 23:16:21 +00:00
Baohong Liu 9376f876df drivers: adc: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: Ifeadaffcc2167729c4a7c7d1aea4ea6d6c5b833c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 23:16:05 +00:00
Baohong Liu 9cf46e52dc drivers: rtc: update to unified kernel
Change the included kernel header file from nanokernel.h
to kernel.h

Change-Id: I754b883d1769517e908e88096e7704666ec12275
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 14:40:43 -08:00
Baohong Liu 14d079a13c drivers: pwm: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I76eeab4dbb4259aa1147f524645c4ca8a8a48398
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 05:12:38 +00:00
Baohong Liu 3c01b5db57 drivers: wdt: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I1e051271212290a90a5659190bf031e9961e1917
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 05:12:19 +00:00
Baohong Liu 1a7f755785 drivers: dma: update to unified kernel
Change the included kernel header file from nanokernel.h
to kernel.h

Change-Id: I76cc952316430d618ea3ecb526d9bc2a99f04cef
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-09 18:38:57 -08:00
Baohong Liu 82193c59e3 drivers: i2c: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I17cde2f2cf457ac60905824ae581ede495f02709
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 02:00:07 +00:00
Baohong Liu 8cc98d71cd drivers: flash: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I430a239afdb49bfbbd7829442bbdd17c7d736663
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 01:59:24 +00:00
Baohong Liu 180887a305 drivers: gpio: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: Ic638f28555cb9c8a23b365e39368062c37d7716f
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 01:38:53 +00:00
Baohong Liu 6fe94d6431 drivers: rtc: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I8d3dbb637d10e8b184a29aec730338539f9b68a8
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-09 20:32:11 +00:00
Baohong Liu aa32a0914a drivers: counter: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I05e4bf18da89c521e0de1216c074019dfed4ac37
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-09 20:27:42 +00:00
Andrew Boie 0b474eef9c kernel: deprecate old init levels
PRIMARY, SECONDARY, NANOKERNEL, MICROKERNEL init levels are now
deprecated.

New init levels introduced: PRE_KERNEL_1, PRE_KERNEL_2, POST_KERNEL
to replace them.

Most existing code has instances of PRIMARY replaced with PRE_KERNEL_1,
SECONDARY with POST_KERNEL as SECONDARY has had a longstanding bug
where the documentation specified SECONDARY ran before the kernel started
up, but actually ran afterwards.

Change-Id: I771bc634e9caf7f17dbf214a270bc9967eed7d32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-09 17:59:44 +00:00
Johan Hedberg d7f4fd74a9 Bluetooth: Use depends on SERIAL instead of selects
This suppresses warnings for platforms where SERIAL can't be provided.
All the platforms that these drivers are interesting for already
default to SERIAL=y.

Change-Id: Id692f99e018009b30903db8a2c046a6086be01c2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-09 08:57:52 +02:00
Szymon Janc b73b77652c Bluetooth: nble: Use unified k_sem API for semaphores
Change-Id: I5bf66ab7c3f863945f2c9f9392d773b348020367
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-09 08:57:52 +02:00
Jithu Joseph 7eab305593 usb: Add end-point stall APIs and flow control APIS
USB class drivers may need to offload some work from
upcall interrupt context to a background fiber. This
requires some way to defer taking more data from host
till the offloaded work completes. Two APIs are added to
achieve this.

Further USB class drivers sometimes need to set STALL condition
on end-points to signal errors to host.These too are
added.

Change-Id: Ic973522c3394e23d7f9c4c67affc0cd050afc20f
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-09 02:45:46 +00:00
Baohong Liu 6096e7866c drivers: spi: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I0424e8b1fee51df6fd3eb06ba6d99284a2e83393
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-09 02:40:32 +00:00
Iván Briano f4764fc348 counter qmsi: Enable the driver to work on ARC
Jira: ZEP-1030

Change-Id: I3f5e26f399a163467ec8371802b7472d87416940
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-08 14:37:35 -02:00
Baohong Liu 05bed1c663 drivers: pwm_qmsi: add type cast to prevent overflow
Add type cast to prevent overflow.

In the pwm driver function pwm_qmsi_get_cycles_per_sec(),
there is a multiplication which takes ticks_per_us (32 bit
unsigned integer) and USEC_PER_SEC. Practically, overflow
will not happen, since the sys clock is not that high. But,
it can trigger an overflow alarm by automatic tools.

Change-Id: I67e6f6a4763e62f6674fcdd364880d93829e739e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-08 14:28:26 +00:00
Baohong Liu 9d89fa5ec5 drivers: rtc: Add delay to wait for new config to take effect
Add delay to wait for new configuration to take effect before
returning to API caller. It takes time for any change to rtc
configuration to take effect since rtc runs under a much slower
clock.

Of course, we do not have an equation for best wait time.
The value is based on the test results on arduino 101, minfield
and quark se c1000 devboard(some margin added).

Jira: ZEP-991

Change-Id: I0dcee3c5809963dcd418186b85e3473427a4d526
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-08 14:28:14 +00:00
Andrew Boie 6450aa455c ieee802154_cc2520: use new kernel sleep APIs
Change-Id: Ia1831108d2f57f76244c9d0a35c47308373aaa1c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:34:15 -08:00
Andrew Boie 9024a93bee drivers: timer: remove old kernel support
Change-Id: I64169402d6e3b6cb0e89beeceba8b5a3bf734cf4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:32:57 -08:00
Jorge Ramirez-Ortiz 27ecd5d8f3 drivers: flash: SoC KSDK
This KSDK flash shim driver supports the device in the FRDM K64F
platform (enabled with this commit).

WARNING: the driver disables the system interrupts for potentially
long periods of time. This is required to avoid Read-While-Write
issues since most platforms run in XIP mode.

For more detailed information see the link below:
http://cache.freescale.com/files/32bit/doc/app_note/AN4695.pdf

Change-Id: I70f8d09080251033ce2f45be0c2eb95c19fded08
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2016-11-07 18:43:16 +00:00
Tomasz Bursztyka 3fb51f6f46 drivers: gpio: Remove mmio driver
It's unused anywhere and unlikely to be in the future.

Change-Id: I57926e91da7d31ef6ddda4f86e6dac103dbfa176
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-11-07 07:20:04 -05:00
Vinayak Chettimada 13534dbf2c drivers: clock_control: Add nRF5x 32KHz source and accuracy support
Change-id: I0b0909f06c784e340eeed472124e8bcbdffd4337
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-11-07 12:04:02 +00:00
Jesus Sanchez-Palencia 55c00ad721 ext qmsi: Update to 1.3.1 version
Update to QMSI 1.3.1 release.

The only build fix needed was due to the split of the I2C ISR on
qm_isr.h .

Change-Id: Ide7a1537572c72981ec3283dc5cf0d543d9ac7d1
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-11-04 23:31:29 +00:00
Maureen Helm 33ee93d7dd serial/uart_k20: Fix instance source clock frequencies
The uart_k20 serial driver incorrectly assumed that all instances of the
UART peripheral are driven by the system clock, when actually some
instances are driven by the bus clock (which usually runs at half the
system clock). This caused incorrect baud rate calculations for UART
instances driven by the bus clock (UART2-4).

Change-Id: I38041781cdee146912bb5167e7c71d6416b966b5
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-11-04 23:00:04 +00:00
Maureen Helm 2393154621 frdm_k64f: Change PTC16-17 pinmux to select UART signals
These pins are routed to the arduino header, and configuring them for
UART signals allows us to use the frdm_k64f with a frdm_kw40z shield
board for bluetooth.

Change-Id: Ie30916409844b1dc1c6e1280d5a755a6dc42e418
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-11-04 23:00:03 +00:00
Benjamin Walsh 8cf56bcac7 unified: dissociate system workqueue from common workqueue module
Making a reference to the common work queue code should not necessarily
drag in the system workqueue, since it is possible to use a workqueue
that is not the system workqueue. This is done by moving the system
workqueue into its own code module.

Moving the system workqueue to its own code module allows removing the
NANO_WORKQUEUE and SYSTEM_WORKQUEUE kconfig options, and compiling the
common workqueue code and system workqueue all the time. They are only
linked in the final image if a reference to them exist, same as the
other kernel modules.

Change-Id: I6f48d2542bda24f4702e7c2e317818dd082b3c11
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-04 22:39:54 +00:00
Johan Hedberg 26d39cd107 Bluetooth: Move controller code to subsys/bluetooth
Move controller code from drivers/controller to
subsys/bluetooth/controller.

Change-Id: I73f675188485aa3267507bad7647796e593a3da0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-04 22:05:05 +02:00
Johan Hedberg 6bc645962a Bluetooth: Move Bluetooth host stack to subsys
Move the Bluetooth host stack from net/bluetooth to
subsys/bluetooth/host. This is preparation for having both host and
controller under the same root, i.e. subsys/bluetooth/.

Change-Id: I3bc796f7e331fca0c485f3890d62b9c03e027b96
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-04 22:05:05 +02:00
Gil Pitney e8b43cbc81 cc3200: Add a UART driver (polled and interrupt modes)
The pinmux configuration is done during board initialization.

This was validated using the following Zephyr apps:
- samples/hello_world
- samples/philosophers
- samples/drivers/uart
- samples/shell

UARTA0 is currently supported.

Change-Id: I85727c622d4d42183cc9f2f8b43d653e245dd17e
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2016-11-04 14:53:33 +00:00
Anas Nashif f815d069b8 shell: move documentation out of kernel
The shell is not a kernel feature, it is more of a subsystem.

Change-Id: Iaba60b2086ddfe77af427d70b8fc8d06a8bebe14
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-04 13:48:16 +00:00
Anas Nashif b27d3a8a60 shell: split kernel shell into separate module
Add kernel functions to kernel module and make it part
of the shell sample.

Change-Id: If5e8ff8ce7b8edbbb8d62509964700b007eaf88b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-04 13:48:15 +00:00
Anas Nashif 559b46f37d shell: move shell Kconfig to drivers/console/shells
Cleanup some unneeded ifdefs in C files.

Change-Id: Icd1f34f2d24b531ad5320e3436cce048d236a4f0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-04 13:48:15 +00:00
Neil Armstrong 369fc75a98 pinmux/stm32: add support for pinmux of port h
Add the definition required to change the pinmux of port H.

Change-Id: I3cc107f9151db4d38fe2cace90cd02d5955a2717
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-04 05:10:35 -05:00
Neil Armstrong 1f4c05aad9 stm32_exti: add support for controllers with more than 32 lines
Some STM32 have more than 32 EXTI lines. Add support for them.

Change-Id: I9a2561664d0d81664acf268bb2257dd99b596a44
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-11-04 10:01:03 +00:00
Marcus Shawcroft 68cf17171d drivers/gpio_stm32: Make driver_api structure const.
Change-Id: Ifdc5e6aabde3f06305f9d8ca2063b09931c126c4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-04 00:51:16 +00:00
Iván Briano b7f2fafdab counter qmsi: Update suspend/resume implementation
Update the suspend and resume hook after changes in QMSI and the resume
from sleep flow.

Change-Id: I14637b5a29b1942740012243fb8217803cf27e9b
Jira: ZEP-1004
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-03 23:52:37 +00:00
JuanX Solano Menacho 6f8d48e0cb i2c_qmsi: Use qm_i2c_save/restore_context APIs
This commit updates the i2c_qmsi driver by removing the temporary Zephyr
save/restore context implementation and using the new QMSI APIs.

Jira: ZEP-996
Change-Id: I9fbd563f214b757f3435037b3e24da4bcf08da14
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-03 23:52:10 +00:00
JuanX Solano Menacho 356dcdf383 gpio_qmsi: Use qm_gpio_save/restore_context APIs
This commit updates the gpio_qmsi driver by removing the temporary
Zephyr save/restore context implementation and using the new QMSI APIs.

Jira: ZEP-999
Change-Id: Ic7b80a8f86baa7a6be11c93bbdebb18a102b0221
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-03 23:52:09 +00:00
JuanX Solano Menacho dd14b95de0 rtc_qmsi: Update save/restore implemntation with new qmsi APIs
This commit updates the rtc_qmsi driver by modifying the temporary
Zephyr save/restore context implementation and using the new QMSI APIs.

Jira: ZEP-1000
Change-Id: I6f77fe086ea6415a5bc2b2b21874c8a573fd7b44
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-03 23:52:09 +00:00
JuanX Solano Menacho 05daf3a6f0 spi_qmsi: Use qm_spi_save/restore_context APIs
This commit updates the spi_qmsi driver by removing the temporary Zephyr
save/restore context implementation and using the new QMSI APIs.

Jira: ZEP-997
Change-Id: I70c6838025253d13d6ebe690ec90dfc1b18bfcea
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-03 23:52:08 +00:00
JuanX Solano Menacho 5a4c3e3fbb pwm_qmsi: Use qm_pwm_save/restore_context APIs
This commit updates the pwm_qmsi driver by removing the temporary Zephyr
save/restore context implementation and using the new QMSI APIs.

Jira: ZEP-1008
Change-Id: Ic92feeb906539f506eb521b7302f8cf5af3edc64
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-03 23:52:08 +00:00
JuanX Solano Menacho 8a287b1016 uart_qmsi: Use qm_uart_*_context API
Remove the Zephyr implementation and
update the uart_qmsi driver to use new QMSI PM APIs.

Jira: ZEP-998
Change-Id: I418e6384c16e374e9062820e12648a2d524a312d
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-03 23:52:07 +00:00
JuanX Solano Menacho f8130521e2 wdt_qmsi: Use qm_wdt_*_context API
Remove the Zephyr implementation and
update the wdt_qmsi driver to use new QMSI PM APIs.

Jira: ZEP-1001
Change-Id: I4d0a2e3b8cf402b457ee0454650080d406eb6d0a
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-03 23:52:07 +00:00
Julien Delayen ee04a3f6d8 rtc_qmsi: Add get_pending_int API
For AON peripherals on Quark SE C1000, an API is needed
to retrieve the interrupt status after wake up.
This enables the application to know the wake source before
enabling again the interrupts.
Add this API to the rtc as this is a wake event
on Quark SE C1000.

Jira: ZEP-1188

Change-Id: Id850ce405eb3f4857be720201e462ea8e24a334f
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-11-03 21:30:21 +00:00
Julien Delayen bd6285a3f1 gpio_qmsi: Add get_pending_int API
For AON peripherals on Quark SE C1000, an API is needed
to retrieve the interrupt status after wake up.
This enables the application to know the wake source before
enabling again the interrupts.
Add this API to the gpio as this is a wake event
on Quark SE C1000.

Jira: ZEP-1188

Change-Id: Icc4aa6617bf18402b7e5dc3aab779ec2964e1c5b
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-11-03 21:30:11 +00:00
Julien Delayen 14711488db aio_cmp_qmsi: Add get_pending_int API
For AON peripherals on Quark SE C1000, an API is needed
to retrieve the interrupt status after wake up.
This enables the application to know the wake source before
enabling again the interrupts.
Add this API to the aio comparator as this is a wake event
on Quark SE C1000.

Jira: ZEP-1188

Change-Id: Ifa08353270910a363c15a4203770ff3e7857572b
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-11-03 21:30:02 +00:00
Julien Delayen 74799a326e counter_qmsi_aonpt: Add get_pending_int API
For AON peripherals on Quark SE C1000, an API is needed
to retrieve the interrupt status after wake up.
This enables the application to know the wake source before
enabling again the interrupts.
Add this API to the periodic timer as this is a wake event
on Quark SE C1000.

Jira: ZEP-1188

Change-Id: I79976230bccb1f970b6856d28bf7428175167828
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-11-03 21:29:48 +00:00
Erwan Gouriou eed678612b clock_control: have FLASH_BASE compatible with ST CMSIS files
In ST CMSIS files, FLASH_BASE does not mean base address of FLASH register
Instead FLASH_R_BASE is used.
stm32f1 clock control driver is updated to be compatible with this naming.

Change-Id: Ic4fb49c60c392e15fd12c69266baf4c686bd343b
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2016-11-03 20:29:07 +00:00
Szymon Janc 5f6f422ebb console: shell: Reduce completion stack usage
There is no need for copying command string to temporary variable on
the stack.

Change-Id: I41fd2582600908ac523b87c83a426eef27d1c454
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-03 12:50:19 +00:00
Szymon Janc a9386f9707 console: shell: Fix commands tab completion
This fix commands tab completion and make it similar to Linux shell
completion:
 - single match complets command and add space at the end
 - multi match lists matched commands and complete common part
 - no match does nothing

Change-Id: Ib2d90889c79e8d35a78b8847d2b9e124cdc00a6c
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2016-11-03 12:50:19 +00:00
Iván Briano 9ea1b4c15b flash qmsi: Add support for device power management
Add the necessary infrstructure to support power management for the
QMSI Flash driver. If deep sleep is supported, this driver supports
saving its context to be restored on resume.

Jira: ZEP-1006
Change-Id: Ied88e86d13ef9e4e62bd6ac9d8454d9a9a3d2962
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-03 11:14:51 +00:00
Iván Briano d53811ec73 dma qmsi: Add support for device power management
Add the necessary infrastructure to support power management for the
QMSI DMA driver. If deep sleep is supported, this driver supports
saving its context to be restored on resume.

Jira: ZEP-1005
Change-Id: I49f1f985eb0f250c777c6950178715fb794db537
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-03 11:14:51 +00:00
Iván Briano f028973f43 gpio qmsi: Enable SoC level GPIO to work on ARC too
The GPIO and AON GPIO ports are available to both the x86 and ARC
cores, but the driver always assumed only the x86 at the time of
configuring interrupts.

Use the available macros to set the correct values independently of
which core it's being built for.

Jira: ZEP-1030
Change-Id: I310afcc48780fbe1cac9dc3368a6de11bd797fda
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:56 +00:00
Iván Briano 34cf9773b1 gpio qmsi: Differentiate between the SoC GPIO and SS GPIO
The SoC level peripherals are accesible by both cores, while the SS
ones are only available to the sensor subsystem. Since the ARC core can
make use of both drivers at the same time, we need to be able to
differentiate their configuration values somehow.

Also disable the SoC GPIO for the ARC by default, as it still needs
more changes to be usable.

Jira: ZEP-1030
Change-Id: Ic5415c404ecd32a3e560467b6f5eaa873a515d72
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:52 +00:00
Iván Briano 5b2160b598 watchdog qmsi: Enable the driver to work on ARC
Jira: ZEP-1030
Change-Id: Iab5bb301dae9a18dc2050606f230606ef76bebb5
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:48 +00:00
Iván Briano 244af4a2af aio qmsi: Enable the driver to work on ARC
Jira: ZEP-1030
Change-Id: I614646053974d6a81579bbea9d969a10916f9cac
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:44 +00:00
Iván Briano cb6cba2c70 dma qmsi: Enable the driver to work on ARC
Jira: ZEP-1030
Change-Id: I29f742762d92ca86361be9c9ed76e8cea21d58b6
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:40 +00:00
Iván Briano b63e635a18 rtc qmsi: Enable the driver to work on ARC
Jira: ZEP-1030
Change-Id: Ie57b183c9fdf0e0cb70c7d81b92b221d54a32c0f
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:28 +00:00
Iván Briano 5b31f76113 uart qmsi: Use provided macros to configure IRQ
Use the macros provided by QMSI (or by ourselves, when QMSI doesn't
have them yet) to register interrupts independently of which core it's
building for.

Change-Id: I83fd7e42598b45aef8132316906a3bff291dfe92
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:27 +00:00
Iván Briano 3139a10017 gpio qmsi: Remove unnecesary callback wrappers
The callback from the QMSI driver now can take a data pointer to pass
to the given function, so use that to pass the device to our callback
instead of defining one function for each supported port.

Change-Id: I82d863314e0443b7c4a12d4a9ad763b9634ca8e2
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:26 +00:00
Iván Briano 0792e417e1 gpio qmsi: Remove stale comments
Change-Id: Ic69343019a619263c3d3b4ba378476504a33bec2
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:26 +00:00
Szymon Janc 6fc74083db console: shell: Fix not printing selected module prompt
If application prompt handler returns NULL curently selected module
prompt should also be checked before of printing default shell prompt.

Change-Id: Iba9c191041951c31036766b1cc8070b040655445
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2016-11-02 21:55:47 +00:00
Yael Avramovich d5db35204a console: shell: Support multiple modules
Ability to use Zephyr shell by multiple modules simultaneously, each
module for its own usage.

Old shell implementation enabled the user to call only one module
commands, not all of the modules simultaneously.

Change-Id: I0ef8fa2fd190b7490c44fe91d1016363258302c9
Signed-off-by: Yael Avramovich <yael.avramovich@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-02 00:23:18 +00:00
Andrew Boie a6463a93c1 drivers: ieee802154_cc2520: fix unified build
In the unified kernel legacy layer, both these functions are
implemented as #defines which can't be put in a struct.

Eventually this driver should be updated to use new APIs, but
this will get it to at least build which is the priority.

Change-Id: Ic5dfb5b85ff3bd0d1646f542340642549a2b2e05
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-02 00:00:29 +00:00
Szymon Janc a037316bb5 console: Add support for DEL key
This allows to delete character after cursor.

Change-Id: I9acc5e1edeb688ea4ec36e91aef69ecb5f5f6354
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-01 23:37:37 +00:00
Szymon Janc 6b0cf54c60 console: Add support for HOME and END keys
This allows to navigate to begining and end of the line easily.

Change-Id: I3a839a0499961d55574a310c65811dd2fe048703
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-01 23:37:36 +00:00
Carles Cufi 20952b75e3 Bluetooth: uart: Fix UART TX stall condition
In 3 of our UART driver implementations the ISR is exclusively
used and enabled for the RX path. The existing logic was
susceptible to a stall situation where a polled out transmission
would be interrupted by a reception and then the ISR code
would loop forever due to the TX event being signalled (although
the interrupt itself was disabled) causing the ISR to keep
looping for an RX interrupt.

Change-Id: Ic379e58b1c974aca3cee37d2d81f12c3726fb160
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-11-01 21:40:39 +02:00
Johan Hedberg 900fbc20ba boards: x86: Don't default to 'y' with NRF51_PM and WAIT_NOP
These options were only needed for a MyNewt-based nRF51 firmware on
these boards (the MyNewt BLE stack is called Nimble, hence the
prj_nimble.conf sample config files). With a Zephyr-based nRF51
firmware these options are no-longer needed, so it's not appropriate
to have them default to enabled. Instead, if they are needed, require
the app-specific configuration to enable them.

Change-Id: Iefbee4d97590af4e11bcedea05fe61f32a147b83
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-01 19:37:26 +00:00
Jesus Sanchez-Palencia fd4dc0f11f wdt: Remove unneeded include from wdt_qmsi.c
qm_interrupt.h is not needed.

Change-Id: Ia9e62db9fc39ee7a8a36e087eb447cbc4a419817
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-10-31 20:58:33 +00:00
Baohong Liu 8ecfcc8ca4 pwm: qmsi_shim: implement pwm driver required by new APIs
Implement qmsi shim driver based on the new API interfaces.

Recently, a RFC was sent and discussed on the re-design of
PWM interfaces. A API change was already posted.

The API new design will deprecate all existing APIs and three
new APIs will be added. The new APIs are pwm_pin_set_cycles,
pwm_pin_set_usec and pwm_get_cycles_per_sec. Pwm_pin_set_cycles
and pwm_pin_set_usec will rely on two driver functions to set
the period and pulse width. This change is to implement the
driver functions pwm_qmsi_pin_set and pwm_qmsi_get_cycles_per_
sec.

Jira: ZEP-745

Change-Id: I39bb973f8c5b19cb7dbd496d10e7f0b6735efc12
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-10-31 20:01:05 +00:00
Iván Briano 0094ab228d ext qmsi: Update to QMSI 1.3 release
Update the QMSI drop we maintain in Zephyr, and fix the build where
needed:

- QM_SCSS_INT is renamed to QM_INTERRUPT_ROUTER;
- every member of QM_INTERRUPT_ROUTER was renamed as well;
- QM_IRQ_* renamed too, mostly added _INT at the end;
- some isr functions were renamed to keep their names consistent;
- build for x86 needs to define QM_LAKEMONT, as QM_SENSOR was for ARC.

Change-Id: I459029ca0d373f6c831e2bb8ebd52402a55994d1
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-10-31 13:26:06 +00:00
Johan Hedberg f4d7538187 Merge bluetooth branch into master
Main changes:

 - Fixes to build with unified kernel
 - Switch to unified kernel for all Bluetooth samples
 - Fixes to controller HCI interface
 - Fix net_buf leak in controller
 - Initial skeleton for AT command support (for Hands-Free Profile)
 - Rename bt_driver API to bt_hci_driver

----------------------------------------------------------------
Anas Nashif (2):
      Bluetooth: cleanup testcase.ini and adapt to current platforms
      Bluetooth: tests optimize testcase.ini for shell and init

Arkadiusz Lichwa (2):
      Bluetooth: L2CAP: Minor cleanup in naming
      Bluetooth: L2CAP: Minor cleanup in conn request

Carles Cufi (6):
      Bluetooth: Controller: Set HCI version to 4.2
      Bluetooth: hci-uart: Use a fiber to offload TX from ISR
      Bluetooth: HCI: Remove "EDR" and "HS" marketing terms from macros
      Bluetooth: hci-uart: Add a sample configuration file for nRF5x
      Bluetooth: Controller: Fix net_buf memory leak in RX path
      Bluetooth: hci-uart: Match controller buffers in UART RX

Johan Hedberg (10):
      Bluetooth: samples/README: Document hci-usb and hci-uart
      Bluetooth: Expose BLUETOOTH_MAX_CONN for controller-only build
      Bluetooth: samples: Remove redundant CONFIG_ARC_INIT=n
      Bluetooth: Rename bt_driver to bt_hci_driver
      Bluetooth: samples/hci-uart: Make sure we yield in tx_fiber
      Bluetooth: drivers/Kconfig: Fix inconsistency issues
      Bluetooth: Fix license header in l2cap.h and rfcomm.h
      Bluetooth: tests/init: Limit controller+host for 32kB RAM platforms
      Bluetooth: samples: Limit tests to just qemu platforms
      Bluetooth: samples/hci-uart: Add arduino_101_ble to tests

Luiz Augusto von Dentz (3):
      Bluetooth: L2CAP: Delete fragments as they are processed
      Bluetooth: GATT: Add helper to discover next range
      Bluetooth: GATT: Add proper check for connection state

Sathish Narasimman (1):
      Bluetooth: Generic AT command implementation

Szymon Janc (12):
      Bluetooth: Include zephyr.h instead of kernel specific headers
      Bluetooth: A2DP: Cleanup headers includes
      Bluetooth: Remove not needed includes
      Bluetooth: L2CAP: Fix build with unified kernel
      Bluetooth: L2CAP: Use helper for accessing nano_sem count
      Bluetooth: RFCOMM: Use helper for accessing nano_sem count
      Bluetooth: A2DP: Remove includes from internal header
      Bluetooth: hci-uart: Don't include nanokernel.h
      Bluetooth: drivers: Remove usued variables from H5 driver
      Bluetooth: drivers: Fix non-ASCII characters in NBLE code comments
      Bluetooth: Use unified kernel build for tests and samples
      Bluetooth: drivers: Include zephyr.h instead of nanokernel.h

 doc/api/bluetooth.rst              |   2 +-
 drivers/bluetooth/Kconfig          |  99 +--
 drivers/bluetooth/Makefile         |   3 +-
 .../bluetooth/controller/hci/hci.c |   2 +-
 .../controller/hci/hci_driver.c    |  20 +-
 drivers/bluetooth/hci/Kconfig      | 116 ++++
 drivers/bluetooth/hci/Makefile     |   2 +
 drivers/bluetooth/{ => hci}/h4.c   |  16 +-
 drivers/bluetooth/{ => hci}/h5.c   |  25 +-
 drivers/bluetooth/nble/Kconfig     |   2 +-
 drivers/bluetooth/nble/gap.c       |   2 +-
 drivers/bluetooth/nble/gatt.c      |   4 +-
 drivers/bluetooth/nble/smp.c       |   2 +-
 drivers/bluetooth/nble/uart.c      |   4 +-
 include/bluetooth/hci.h            |  11 +
 .../{driver.h => hci_driver.h}     |  38 +-
 include/bluetooth/l2cap.h          |  32 +-
 include/bluetooth/rfcomm.h         |  32 +-
 net/bluetooth/Kconfig              |  17 +-
 net/bluetooth/Makefile             |   2 +-
 net/bluetooth/a2dp.c               |   6 +-
 net/bluetooth/a2dp_internal.h      |   8 -
 net/bluetooth/at.c                 | 334 +++++++++++
 net/bluetooth/at.h                 |  82 +++
 net/bluetooth/att.c                |   6 +-
 net/bluetooth/avdtp.c              |   4 +-
 net/bluetooth/conn.c               |   6 +-
 net/bluetooth/gatt.c               | 146 +++--
 net/bluetooth/hci_core.c           |  17 +-
 net/bluetooth/hci_core.h           |   2 +-
 net/bluetooth/hci_ecc.c            |   2 +-
 net/bluetooth/hci_raw.c            |  10 +-
 net/bluetooth/hfp_hf.c             |   2 +-
 net/bluetooth/keys.c               |   2 +-
 net/bluetooth/keys_br.c            |   2 +-
 net/bluetooth/l2cap.c              |  27 +-
 net/bluetooth/l2cap_br.c           |  11 +-
 net/bluetooth/log.c                |   2 +-
 net/bluetooth/monitor.c            |   2 +-
 net/bluetooth/rfcomm.c             |  17 +-
 net/bluetooth/smp.c                |   3 +-
 net/bluetooth/smp_null.c           |   2 +-
 net/bluetooth/uuid.c               |   2 -
 samples/bluetooth/README           |  13 +-
 samples/bluetooth/beacon/Makefile  |   3 +-
 samples/bluetooth/beacon/prj.conf  |   1 -
 samples/bluetooth/beacon/prj.mdef  |   5 -
 .../bluetooth/beacon/prj_nble.conf |   1 -
 .../bluetooth/beacon/testcase.ini  |  12 +-
 samples/bluetooth/central/Makefile |   3 +-
 samples/bluetooth/central/prj.conf |   1 -
 samples/bluetooth/central/prj.mdef |   5 -
 .../bluetooth/central/testcase.ini |  12 +-
 .../bluetooth/central_hr/Makefile  |   3 +-
 .../bluetooth/central_hr/prj.conf  |   1 -
 .../bluetooth/central_hr/prj.mdef  |   5 -
 .../central_hr/testcase.ini        |   3 -
 .../bluetooth/eddystone/Makefile   |   3 +-
 .../bluetooth/eddystone/prj.conf   |   1 -
 .../bluetooth/eddystone/prj.mdef   |   5 -
 .../eddystone/prj_nble.conf        |   1 -
 .../eddystone/testcase.ini         |  12 +-
 .../bluetooth/hci-uart/Makefile    |   4 +-
 .../bluetooth/hci-uart/nrf5.conf   |  13 +
 .../bluetooth/hci-uart/prj.conf    |   1 -
 .../bluetooth/hci-uart/src/main.c  |  43 +-
 .../hci-uart/testcase.ini          |   9 +-
 samples/bluetooth/hci-usb/Makefile |   2 +-
 samples/bluetooth/hci-usb/prj.conf |   1 -
 samples/bluetooth/ipsp/Makefile    |   3 +-
 samples/bluetooth/ipsp/prj.conf    |   1 -
 samples/bluetooth/ipsp/prj.mdef    |   5 -
 .../bluetooth/ipsp/testcase.ini    |   1 -
 .../bluetooth/peripheral/Makefile  |   3 +-
 .../bluetooth/peripheral/prj.conf  |   1 -
 .../bluetooth/peripheral/prj.mdef  |   5 -
 .../peripheral/prj_nble.conf       |   1 -
 .../peripheral/testcase.ini        |  12 +-
 .../peripheral_csc/Makefile        |   3 +-
 .../peripheral_csc/prj.conf        |   1 -
 .../peripheral_csc/prj.mdef        |   5 -
 .../peripheral_csc/prj_nble.conf   |   1 -
 .../peripheral_csc/testcase.ini    |  12 +-
 .../peripheral_dis/Makefile        |   3 +-
 .../peripheral_dis/prj.conf        |   1 -
 .../peripheral_dis/prj.mdef        |   5 -
 .../peripheral_dis/testcase.ini    |  12 +-
 .../peripheral_esp/Makefile        |   3 +-
 .../peripheral_esp/prj.conf        |   1 -
 .../peripheral_esp/prj.mdef        |   5 -
 .../peripheral_esp/prj_nble.conf   |   1 -
 .../peripheral_esp/testcase.ini    |  12 +-
 .../peripheral_hids/Makefile       |   3 +-
 .../peripheral_hids/prj.conf       |   1 -
 .../peripheral_hids/prj.mdef       |   5 -
 .../peripheral_hids/prj_nble.conf  |   1 -
 .../peripheral_hids/testcase.ini   |  12 +-
 .../peripheral_hr/Makefile         |   3 +-
 .../peripheral_hr/prj.conf         |   1 -
 .../peripheral_hr/prj.mdef         |   5 -
 .../peripheral_hr/prj_nble.conf    |   1 -
 .../peripheral_hr/testcase.ini     |  12 +-
 .../peripheral_sc_only/Makefile    |   3 +-
 .../peripheral_sc_only/prj.conf    |   1 -
 .../peripheral_sc_only/prj.mdef    |   5 -
 .../testcase.ini                   |  12 +-
 tests/bluetooth/init/Makefile      |   3 +-
 tests/bluetooth/init/prj.mdef      |   5 -
 tests/bluetooth/init/prj_17.conf   |   2 +-
 tests/bluetooth/init/prj_20.conf   |   2 +-
 tests/bluetooth/init/prj_21.conf   |   2 +-
 .../init/prj_controller_dbg.conf   |   2 +-
 .../bluetooth/init/prj_h5_dbg.conf |   2 +-
 tests/bluetooth/init/testcase.ini  |  81 +--
 tests/bluetooth/shell/Makefile     |   3 +-
 tests/bluetooth/shell/prj.mdef     |   5 -
 .../bluetooth/shell/prj_nble.conf  |   1 -
 .../shell/prj_nimble.conf          |   1 -
 tests/bluetooth/shell/testcase.ini |  49 +-
 .../test_bluetooth/Makefile        |   3 +-
 .../test_bluetooth/prj.mdef        |   5 -
 .../test_bluetooth/src/bluetooth.c |   8 +-
 .../test_bluetooth/testcase.ini    |   8 +-
 tests/bluetooth/tester/Makefile    |   3 +-
 tests/bluetooth/tester/prj.mdef    |   5 -
 .../bluetooth/tester/prj_nble.conf |   1 -
 .../tester/prj_nimble.conf         |   1 -
 .../bluetooth/tester/testcase.ini  |   2 -
 128 files changed, 893 insertions(+), 752 deletions(-)
 create mode 100644 drivers/bluetooth/hci/Kconfig
 create mode 100644 drivers/bluetooth/hci/Makefile
 rename drivers/bluetooth/{ => hci}/h4.c (95%)
 rename drivers/bluetooth/{ => hci}/h5.c (96%)
 rename include/bluetooth/{driver.h => hci_driver.h} (73%)
 create mode 100644 net/bluetooth/at.c
 create mode 100644 net/bluetooth/at.h
 delete mode 100644 samples/bluetooth/beacon/prj.mdef
 delete mode 100644 samples/bluetooth/central/prj.mdef
 delete mode 100644 samples/bluetooth/central_hr/prj.mdef
 delete mode 100644 samples/bluetooth/eddystone/prj.mdef
 create mode 100644 samples/bluetooth/hci-uart/nrf5.conf
 delete mode 100644 samples/bluetooth/ipsp/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_csc/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_dis/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_esp/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_hids/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_hr/prj.mdef
 delete mode 100644 samples/bluetooth/peripheral_sc_only/prj.mdef
 delete mode 100644 tests/bluetooth/init/prj.mdef
 delete mode 100644 tests/bluetooth/shell/prj.mdef
 delete mode 100644 tests/bluetooth/test_bluetooth/prj.mdef
 delete mode 100644 tests/bluetooth/tester/prj.mdef

Change-Id: I4ddbfc4dfd66231770dbff937636ca1392fd74bc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 23:17:44 +03:00
Amit Kucheria eb0f8ab9fc boards: 96b_carbon: Add support for 96boards Carbon board
Add support for the STM32F401 chip on the board

Change-Id: I96c0799f3658ecea096fa5971bce9faf21919ee1
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-28 18:58:06 +00:00
Ricardo Salveti 779fb0586a boards: nucleo_f401re: add new board
Add configuration for Nucleo-64 F410RE board.

Change-Id: I88b06d87f0fc62b941241cc2f374b8541de86e00
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-28 18:58:05 +00:00
Kumar Gala 2f9d83d340 uart: stm32: add support for STM32F4
Change the clock accessors to a tuple of bus ID of the subsystem and enable
bits for the device - it is clearer to read than the opaque pointers.

Change-Id: I9ae73c222c04adac4cf2bc06e97f4ec199bdac3c
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-28 18:58:05 +00:00
Ricardo Salveti 1c1bd9a018 pinmux: stm32: add support for STM32F4
STM32F401 allows for upto 16 alternate functions on each pin.

Change-Id: Ib1c14fd31abaa2b05a5ab0f7bd1b4a4748f10f84
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-28 18:58:04 +00:00
Ricardo Salveti cf59106433 gpio: stm32: add support for STM32F4
Implements MCU-specific GPIO input interrupt integration.  Added
definition of System configuration controller as well as its needed by
the GPIO code.

The SYSCFG controller is used for system-specific configuration such as:
 - remap the type of memory accessible at address 0x00000000
 - manage the external interrupt line connection to GPIOs
 - configure the I/O compensation cell

Change-Id: Id2ebfbd1b21e77be76406d1cd6cd5d4989e9e2fa
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-28 18:58:03 +00:00
Ricardo Salveti 3580a6bcec clock_control: stm32f4x: introduce driver for STM32F4x RCC
Based on the STM32F10x driver. Removing old code as we need to use the
bus number when dealing with 4 possible peripherals.

Change-Id: Id0263aa008e9b039ff9a00339e5622e289ffdf99
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-28 18:58:03 +00:00
Amit Kucheria 95e7fb6c98 arm: st_stm32: Add support for STM32F4x SoC family
This patch adds support for the STMicroelectronics STM32F4x family in the
STM32 MCU line. Configuration is included for the STM32F401RE MCU.

Acknowledgements to Pawel Wodnicki's earlier submission from February that
was used as a starting point for this port. In the end, we rewrote all of it.

Change-Id: I9797c282ac3c0cc66a63b9d34821de95df537ef6
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-28 18:58:02 +00:00
Szymon Janc 4a345d3196 Bluetooth: drivers: Include zephyr.h instead of nanokernel.h
zephyr.h includes required kernel header depending on selected
configuration.

Change-Id: Ieb5666c96f94708a42f605c09eb710f8d2eee4ec
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-28 16:34:17 +02:00
Marcus Shawcroft 4117ac2ba2 drivers:config: Fix help text format.
The correct layout for help text is <TAB><SPACE><SPACE>.

Change-Id: Ief4167e75709e358089f701041ac06386351f423
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 12:35:19 +00:00
Marcus Shawcroft 989f216357 grove/light_sensor: Limit name space, add static.
Change-Id: I4defcdee69a20ff7a9a5120f96a13ecc747ea5d1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:55:46 +00:00
Marcus Shawcroft cfc5345ac6 grove/light_sensor: Make driver_api structure const.
Change-Id: Ib06404fa80bdce797b2446ce13468193241e2f7a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:55:45 +00:00
Marcus Shawcroft d8d5cb172d grove/temperature_sensor: Limit name space, add static.
Change-Id: I81167e7363aaaebfcf861a60af0f9fca214d3dec
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:55:45 +00:00
Marcus Shawcroft dfaeb79996 grove/temperature_sensor: Make driver_api structure const.
Change-Id: I7f7223bed0f5be955000bad0256bc29f5a89bc6b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:55:45 +00:00
Marcus Shawcroft 914432853a driver/gpio/qmsi: Limit name space, add static.
Change-Id: I77133e665cdc4995db83302389ecf64d79b08f35
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:54:18 +00:00
Marcus Shawcroft 925a46fd6d gpio/sch: Limit name space, add static.
Change-Id: I16563e2162b2cc9de649663d04a813ab765c3253
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:54:17 +00:00
Marcus Shawcroft 56319c9567 gpio/sch: Make driver_api structure const.
Change-Id: I4866aa02fe6fb8d8a6260bd01fda60c9962e89f8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:54:17 +00:00
Marcus Shawcroft f35d0e6ead gpio/pcal9535a: Limit name space, add static.
Change-Id: I474bad1a44efda66cd2e324483742a257fac77e2
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 10:54:16 +00:00
Marcus Shawcroft 15dbaa8e90 gpio/k64: Fix Kconfig help text formatting.
Change-Id: I8c1e155a152343eaf680be5f8385548058a95c47
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 07:02:20 +01:00
Marcus Shawcroft 7df2727545 gpio/k64: Fix type in GPIO_K64_C_DEV_NAME text.
Change-Id: Ie65c747467890d9f25dc9795c23eaf39175d14ae
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-28 07:02:12 +01:00
Johan Hedberg 4599255871 Bluetooth: drivers/Kconfig: Fix inconsistency issues
Fix issues with tab vs space as well as missing license/copyright
header in hci/Kconfig.

Change-Id: Id766308dc8eda2d598ea749e5e0d2166014db929
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 08:09:08 +03:00
Johan Hedberg 6989bf88e1 Bluetooth: Rename bt_driver to bt_hci_driver
The bt_driver API was created when Zephyr only had a Bluetooth host
stack, but no controller-side functionality. The only "driver" that
was needed for the host was the HCI driver, and hence "HCI" was
omitted from the name.

With support both for host and controller Zephyr will be getting more
Bluetooth driver types, in particular radio drivers. To prepare for
this, move all HCI drivers to drivers/bluetooth/hci/ and rename the
bt_driver API bt_hci_driver.

Change-Id: I82829da80aa61f26c2bb2005380f1e88d069ac7d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 08:09:08 +03:00
Carles Cufi d1fe8e0189 Bluetooth: Controller: Fix net_buf memory leak in RX path
Since RSSI events trigger interrupts and signal the RX path
semaphore with a resulting event lenght of 0. Due to this
fact the Controller HCI driver was leaking (i.e. not freeing)
those events, grinding the recv_fiber to a halt.

Issue identified by Szymon Janc.

Change-Id: I3e259b2823717b523ac331f8f787252414fb9290
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-28 08:09:08 +03:00
Szymon Janc f187ab3b77 Bluetooth: drivers: Fix non-ASCII characters in NBLE code comments
Change-Id: I52377bd00e8890d30128b7cd3b3796abc4d6431d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-28 08:09:08 +03:00
Szymon Janc ca1e885914 Bluetooth: drivers: Remove usued variables from H5 driver
Some variables were never used.

Change-Id: Ic6af13ab3292f1859120b9b939da5dfab7813194
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-28 08:09:08 +03:00
Carles Cufi 40b8ea136a Bluetooth: Controller: Set HCI version to 4.2
Report the HCI version supported by the Controller as 4.2,
since it was set as 0 (1.0b) and this confused certain Host
implementations, such as BlueZ.

Change-Id: I809721ee9c2b55e77e6a3ca63688c802a9ffa0ba
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-28 08:09:08 +03:00
Anas Nashif b152246a83 sensors: make grove sensors depend on CONFIG_SENSOR
The grove sensors use the sensor interface, so make them depend
on it just like the other sensors.

Change-Id: I9b62a3fa26f54dd683c65ca154c1af7c7c92772f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-27 22:14:32 +00:00
Jesus Sanchez-Palencia 5750354f7a dma: Fix QMSI shim by setting the DMA xfer type
Set DMA transfer to QM_DMA_TYPE_SINGLE for all channels.
This keeps the previous behavior as of QMSI 1.1.

In the future, we may consider adding support for using other DMA
transfer types. This, however, will demand adding new API to Zephyr's
dma.h .

Change-Id: I8071555190662a72279069ff9fce3d4b9e861629
Signed-off-by: Maciej Kuc <maciejx.kuc@intel.com>
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-10-27 11:22:58 -07:00
Ricardo Salveti a9f2061dfb gpio: stm32: introduce alternative function config
STM32F4 requires the alternative function config to be set, so just
initialize that as part of the gpio configure call.

Change-Id: I33a4a8efec59c5ebe7dc3f3580f0dd2bf7ded7f4
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-10-27 14:48:43 +00:00
Maureen Helm 3bdc77ee09 sensor: fxos8700: Add accelerometer/magnetometer driver
Adds basic sensor driver support for the NXP FXOS8700 6-axis
accelerometer/magnetometer. Currently this driver supports
accelerometer-only, magnetometer-only, and hybrid (accelerometer +
magnetometer) modes, as well as 2g, 4g, and 8g accelerometer full scale
ranges.

This driver does not yet support any sensor triggers such as the data
ready trigger, or runtime changing of sensor attributes.

Datasheet:
http://cache.nxp.com/files/sensors/doc/data_sheet/FXOS8700CQ.pdf

Origin: Original
Jira: ZEP-721

Change-Id: Iff0f751c737196f60d5c5d3448631b57093ece34
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-27 14:36:43 +00:00
Marcus Shawcroft 1a13bb8c40 sensor/hp206c: Limit namespace, add static.
Change-Id: I08d0029fae70434794e09a7c9563383d1db58fe0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 16:52:15 -04:00
Marcus Shawcroft a2e91dadb3 drivers/hp206c: Make driver_api structure const.
Change-Id: I6e3c7e4e420d9b9c55bbb49cf6f13b6e09ec4bb7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-26 16:52:15 -04:00
Marcus Shawcroft 2030855399 sensor/hp206c: Correct the SYS_CLOCK_TICKS_PER_SEC diagnostic text.
Correct the text of the SYS_CLOCK_TICKS_PER_SEC #error diagnostic to
reflect the actual logic of the gate.

Change-Id: I28ad324b0b246e4a8de29b64483a97577a1b6fb7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:09 +00:00
Marcus Shawcroft 807a103653 watchdog/iwdg_stm32: Limit name space, add static.
Change-Id: I497e2afe0a0e700c1fb95ef50338d44e601248df
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:09 +00:00
Marcus Shawcroft a2017aafa1 watchdog/iwdg_stm32: Fix missing include compilation error.
Change-Id: I0dae37eae451452e6071639b5258634c44c7ccbf
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:08 +00:00
Marcus Shawcroft bcc7f633fc drivers/watchdog: Make WDT_0_IRQ_PRI dependent on WDT_QMSI
The config variable WDT_0_IRQ_PRI is intended to be generic across a
range of watchdog drivers, however it has no default value which means
that if CONFIG_WATCHDOG is enabled, but no driver is provided for a
specific board the the configuration will fail.  For now, make
WDT_0_IRQ_PRI depend on the only driver that uses it.

Change-Id: I54708d66ac8fbc2ef657a1ef4510eb5e7a2cff28
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:07 +00:00
Marcus Shawcroft 27f4947812 driver/gpio/dw: Limit name space, add static.
Change-Id: I3b1f5497896f683072c2bc473d348cd19aca3c5d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:06 +00:00
Marcus Shawcroft c8d6ff0474 driver/gpio/sam3: Limit name space, add static.
Change-Id: Ie34094e3ed8041b2b2c44e122f71d5f69a7ce0ad
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:06 +00:00
Marcus Shawcroft 113bf7c44e driver/flash/w25qxxdv: Limit name space, add static.
Change-Id: I207438d08ab109a448b83e937b19d9503acbbcfb
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:06 +00:00
Marcus Shawcroft 670f7328e8 driver/eth_ksdk: Limit name space, add static.
Change-Id: I45bad57f7a120c74c072287963a2c43f081bcea3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:05 +00:00
Marcus Shawcroft ab7a768a18 driver/eth_dw: Limit name space, add static.
Change-Id: If9de0bec8bafb66119e158782cf9618143dc2a52
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:05 +00:00
Marcus Shawcroft 12c20ef37f driver/ti_adc108s102: Limit name space, add static.
Change-Id: I711a11a3e41626f8f3e97bcb891c6cf048200ee1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:04 +00:00
Marcus Shawcroft 741d4751b2 driver/enc28j60: Limit name space, add static.
Change-Id: Ibf03dbb5134df81ca26aebe1e0518f1973789952
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:04 +00:00
Marcus Shawcroft b70feefaf4 drivers/aio_comparator: Limit name space, add static.
Change-Id: I2b6da1f45f838e9690dcff1bb770c9717cbffede
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:04 +00:00
Marcus Shawcroft 31c39d8f4e drivers/pinmux_dev_atmel_sam3x: Limit name space, add static.
Change-Id: Ic4d23e33b5900137fc7f59f1e320e4844ae44a54
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:03 +00:00
Marcus Shawcroft 0cb864cada grove/lcd: Limit name space, add static.
Change-Id: I1efc5def0a205964309e719f5a1d4e00ce154f12
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:03 +00:00
Marcus Shawcroft a7c5ec1150 ieee802154: Limit name space, add static.
Change-Id: Iaf33a902b90a649ebe8591c33798ad4e583ee33a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:02 +00:00
Marcus Shawcroft c8a359c039 grove/i2c/dw: Limit name space, add static.
Change-Id: I949d07a962c9dc409de9c458a09a9d829f791496
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:02 +00:00
Marcus Shawcroft cbc5a66505 pinmux/dev_stm32: Limit name space, add static.
Change-Id: I023d921b35e5c3188b70bf3413c390f29628d380
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:01 +00:00
Marcus Shawcroft 94e460a92c drivers/isl29035: Make driver_api structure const.
Change-Id: If1d0adeee94663d84049bd8de0de529672ce4dbf
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:01 +00:00
Marcus Shawcroft ac80aa003d drivers/pinmux_dev_stm32: Make driver_api const.
Change-Id: I272dba2e43d270bae5faf63e0955e218d6f392b2
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:01 +00:00
Marcus Shawcroft eb2f6e0325 wdt_qmsi: Make driver_api const.
Change-Id: I35055a6c5d41b3a9474fef45b9e7f8662f286c65
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:00 +00:00
Marcus Shawcroft f84ce64390 serial/uart_nsim: Make driver_api const.
Change-Id: Iefa9afe9cfdbb40e27c6e27f28c26dfea042ca79
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:59 +00:00
Marcus Shawcroft 2e71621149 drivers/rtc_qmsi: Make driver_api const.
Change-Id: I136a31c1955bf4aef834d2c1156b1eed9f6dfa75
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:59 +00:00
Marcus Shawcroft e8e6bead80 drivers/pinmux_dev_k64: Make driver_api const.
Change-Id: I89d8ccbd78a2bbb04ad60a7520c1b7b7b58016ad
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:59 +00:00
Marcus Shawcroft a8dfccc207 drivers/ipm_quark_se: Make driver_api const.
Change-Id: I73077c22b17b0035f3828a0c3a16198abfbf79cc
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:58 +00:00
Marcus Shawcroft fb11feeef5 drivers/soc_flash_qmsi: Make driver_api const.
Change-Id: Id2b2056748c8b50b80fc2224d501e19c15c5e56b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:58 +00:00
Marcus Shawcroft 6cec26caef drivers/soc_flash_nrf5: Make driver_api const.
Change-Id: Ie894304c2f4047eba83730f0553df10b0f0144e1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:57 +00:00
Marcus Shawcroft d8de6cb08d drivers/quark_se_clock_control: Make driver_api const.
Change-Id: I09c2c4aedf6f1e31513f857843f0718b51401f9f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:57 +00:00
Marcus Shawcroft add25f7376 drivers/aio_comparator_qmsi: Make driver_api const.
Change-Id: I334e020b17d3408580e75018a0b50792bc20c0a2
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:56 +00:00
Marcus Shawcroft a7147f7048 pinmux/hexiwear: Make mux_config const and limit name space with static
Change-Id: Iba171d2367e4ff5c4e36f9b876cb5fb11ebd923a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:56 +00:00
Marcus Shawcroft d149a7bf34 pinmux/k64: Make mux_config const and limit name space with static
Change-Id: I91b7ee866c8a66c368b316d1eb30fe760ac26dff
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:55 +00:00
Carles Cufi 749d153afa drivers: uart_nrf5: Remove pull-up configuration from RTS
The Ready To Send (RTS) hardware flow control signal in the nRF5
UART was being configured as an output with a pull-up on it.
This was seemingly causing certain issues with btattach on Linux
and it's not done anywhere else.

Change-Id: Id792d967b043ea7a796d6598500a733c092dbc2c
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-26 12:57:56 +00:00
Marcus Shawcroft 23357b9b73 drivers:ksdk:random: Rename for consistency with other KSDK shim drivers.
The various other KSDK shim drivers follow the name pattern
<DEVICE>_KSDK, renaming the RANDOM driver to follow the pattern.

Change-Id: I89409083f94c0990129726e70a964b02e0dc2802
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:57:20 +00:00
Marcus Shawcroft c172c0792a drivers/counter_qmsi_aonpt: Make driver_api structure const.
Change-Id: If20f5ad587b9398adf1827ec50970c789cfec1a1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:48 +00:00
Marcus Shawcroft c5ec6bdc45 drivers/counter_qmsi_aon: Make driver_api structure const.
Change-Id: Ic455d13543d48700e10c051c85a3c46bddbe98fc
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:48 +00:00
Marcus Shawcroft 3eedeee041 drivers/hts221: Make driver_api structure const.
Change-Id: I81f6d0220ce95cbdb1f3e2b754164a6fd54d0796
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:47 +00:00
Marcus Shawcroft 2696170f11 sensor/th02: Make driver_api structure const.
Change-Id: I6493e84dabafcd301ad6e55d09fd69e02c513294
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:47 +00:00
Marcus Shawcroft 1aa7cbdae7 sensor/sht3xd: Make driver_api structure const.
Change-Id: I66c1fbad5e10a47019a6de00f0420c088954d0ff
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:46 +00:00
Marcus Shawcroft da37763b5b spi/spi_qmsi: Make driver_api structure const.
Change-Id: Icbed6ecd1b405a282e40e3cce1d8e6e1d8235702
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:46 +00:00
Marcus Shawcroft 39e7dc4626 spi/spi_k64: Make driver_api structure const.
Change-Id: Id2ff845f30fa13346eea6e646710192494a5f32e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:45 +00:00
Marcus Shawcroft a5943c9bf1 spi/spi_intel: Make driver_api structure const.
Change-Id: Iecf69f099521f967d65fd1a417f40e96429cc0f8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:45 +00:00
Marcus Shawcroft 6fa3e3436a spi/spi_dw: Make driver_api structure const.
Change-Id: Ib400e73512ab3a0532aa0854ea0c9eba6339487d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:44 +00:00
Marcus Shawcroft 0bac787b08 shared_irq: Make driver_api structure const.
Change-Id: If3551986cef58b494ffc5719cc2de02f48100b85
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:44 +00:00
Marcus Shawcroft d3ea539afc serial/uart_stm32: Make driver_api structure const.
Change-Id: Ia877269952839299c2de12a08d56be9a809fd12c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:44 +00:00
Marcus Shawcroft 7eddbaa21e serial/uart_stellaris: Make driver_api structure const.
Change-Id: I24406298b0928f7dbc154272a32293ecdc04a5d5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:43 +00:00
Marcus Shawcroft 95d962cfed serial/uart_qmsi: Make driver_api structure const.
Change-Id: Iffa46ba38e106569249bce89646cb813dadc2bce
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:43 +00:00
Marcus Shawcroft 7c8b6498e3 serial/uart_ns16550: Make driver_api structure const.
Change-Id: Ie27216f1020504d8c6368d228e2e8e94da8fa51f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:42 +00:00
Marcus Shawcroft f5bc9b12e7 serial/uart_nrf5: Make driver_api structure const.
Change-Id: I066702278afa0bbf6ce4bb916eb1780a8eb2d065
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:42 +00:00
Marcus Shawcroft 6121f92f21 serial/uart_k20: Make driver_api structure const.
Change-Id: I728dd079ff058e8b2a3fa40b4d8c844e8ffd1649
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:41 +00:00
Marcus Shawcroft 800c8722a5 serial/uart_atmel_sam3: Make driver_api structure const.
Change-Id: I745bf7060e4ae0fff5fd4c917d4b979dde1201e9
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:41 +00:00
Marcus Shawcroft 610e9136c6 serial/uart_altera_jtag: Make driver_api structure const.
Change-Id: Iace2f7daac33a146eb834c11f0de13bdd26e2b3d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:40 +00:00
Marcus Shawcroft 1dddd19810 sensor/tmp112: Make driver_api structure const.
Change-Id: I32e53df25364572427be87716864118740da8f99
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:40 +00:00
Marcus Shawcroft 90d4354eef sensor/tmp007: Make driver_api structure const.
Change-Id: I1bdffc48038bc2221ce8f610e857f0be10d90987
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:39 +00:00
Marcus Shawcroft 593c2621a3 sensor/sx9500: Make driver_api structure const.
Change-Id: I96c17c776f37a63dd309c2cd4208239673033c14
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:39 +00:00
Marcus Shawcroft b230c98518 sensor/mpu6050: Make driver_api structure const.
Change-Id: I25a3d1ddbaae101043c5aaaeb0777c74df89242c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:38 +00:00
Marcus Shawcroft 5a1d4a2fd1 sensor/mcp9808: Make driver_api structure const.
Change-Id: Id27a5a5bb085a78747fea32bf94f9552a5e01f33
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:38 +00:00
Marcus Shawcroft 74acab89bc sensor/max44009: Make driver_api structure const.
Change-Id: I4e1226f30b420e7b26d8290543877a7b87665ec5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:37 +00:00
Marcus Shawcroft 38fac62e49 sensor/lsm9ds0_mfd: Make driver_api structure const.
Change-Id: Ifacfff048c95d7ac7061eadbaee2a15b1c01e9db
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:37 +00:00
Marcus Shawcroft f58647788a sensor/lsm9ds0_gyro: Make driver_api structure const.
Change-Id: I51947ce5f01b7ff615cca198b82b1aafe7e7d90e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:36 +00:00
Marcus Shawcroft 1c57f39633 sensor/lsm6ds0: Make driver_api structure const.
Change-Id: I5e689cc7c33ec471379f7506653a4627f983d4d9
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:36 +00:00
Marcus Shawcroft 409d6f87a5 sensor/lps25hb: Make driver_api structure const.
Change-Id: I8c11616b7c57ea165a358b446ea595e73a99e90b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:36 +00:00
Marcus Shawcroft b908f536d3 sensor/lis3mdl: Make driver_api structure const.
Change-Id: I4e6bb185c3ac1fe8f0bd5d186d5dc1c79274078e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:35 +00:00
Marcus Shawcroft 7b92b59c83 sensor/lis3dh: Make driver_api structure const.
Change-Id: Ieaaa1c4cb0268dd18a50e5ced338aa60320d6885
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:35 +00:00
Marcus Shawcroft bb08e1b524 sensor/hmc5883l: Make driver_api structure const.
Change-Id: I4a78f01126055518251c9f6d864174552604fa8b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:34 +00:00
Marcus Shawcroft ccd28b9523 sensor/hdc1008: Make driver_api structure const.
Change-Id: If2c79c29957a49a4fee492d0235060c653d1ef70
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:34 +00:00
Marcus Shawcroft dbb5380020 sensor/dht: Make driver_api structure const.
Change-Id: I49b4a0cc4342cb51e0bbf6ea925da1ae3f55ff78
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:33 +00:00
Marcus Shawcroft 0496b95391 sensor/bmi160: Make driver_api structure const.
Change-Id: I195f9ab2d3668d61c8fbdec5a3f3fa390b81948e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:33 +00:00
Marcus Shawcroft 1f2b984ece sensor/bmg160: Make driver_api structure const.
Change-Id: Iebf5d8dbe652a6839ba435720029b568ab0d7d87
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:32 +00:00
Marcus Shawcroft 1836c61d43 sensor/bme280: Make driver_api structure const.
Change-Id: I8fe4e4a9be88eb07f438e4c580d25fe9deedc343
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:32 +00:00
Marcus Shawcroft 3d8626e95c sensor/bmc150: Make driver_api structure const.
Change-Id: I9c7df241d66e7cc78330d2de3d3a3d1f3be4151f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:31 +00:00
Marcus Shawcroft 4be15a986c sensor/bma280: Make driver_api structure const.
Change-Id: Ia7601a99ca888b582227a0acea42ebd4018e5c44
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:31 +00:00
Marcus Shawcroft beacd063f8 sensor/ak8975: Make driver_api structure const.
Change-Id: I289f9ef59059cd7ed98e6644be2697d2f4d78ced
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:30 +00:00
Marcus Shawcroft 08615c7b6b drivers/pwm_qmsi: Make driver_api structure const.
Change-Id: I03050db2015f7a641127bdfb41659b93032feb9c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:30 +00:00
Marcus Shawcroft 46e39befea drivers/pwm_pca9685: Make driver_api structure const.
Change-Id: I60d2c8c408aab59b85a3b756439b2d22a4ad7d49
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:29 +00:00
Marcus Shawcroft ae6802329c drivers/pwm_k64_ftm: Make driver_api structure const.
Change-Id: I79159bce07ab9a5928cf01103451401ab42a7a7a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:29 +00:00
Marcus Shawcroft db22d3c8da drivers/i2c_qmsi_ss: Make driver_api structure const.
Change-Id: Id7671da509ce6082f2b85a0349d11ce5424a78a3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:28 +00:00
Marcus Shawcroft 042f5da963 drivers/i2c_qmsi: Make driver_api structure const.
Change-Id: If51f4b6e0c37f5864ad24b433b44629f1195d85a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:28 +00:00
Marcus Shawcroft 8707593b93 drivers/i2c_ksdk: Make driver_api structure const.
Change-Id: If8e674b581b75a31e1aa8ba08acf936fabdd44b3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:27 +00:00
Marcus Shawcroft a2f7bed768 drivers/i2c_dw: Make driver_api structure const.
Change-Id: I104912a82920fea08bb32cc1838a80c7f952b1a1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:27 +00:00
Marcus Shawcroft e6cd44fad8 drivers/i2c_atmel_sam3: Make driver_api structure const.
Change-Id: I285e05153beddc15d63ba4437a7d2757c4131e89
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:26 +00:00
Marcus Shawcroft 926c553acb drivers/gpio_qmsi_ss: Make driver_api structure const.
Change-Id: Icfd9675c4bd9572d31b62d12e25be92f5c3104d8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:26 +00:00
Marcus Shawcroft 1b54d26a33 drivers/gpio_qmsi: Make driver_api structure const.
Change-Id: Id123c49a387818f795b1c967463a7d14cc880efd
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:25 +00:00
Marcus Shawcroft 3385b7a074 drivers/gpio_pcal9535a: Make driver_api structure const.
Change-Id: Ifed95143422537ad82bfaa907874b1e33e782fb5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:25 +00:00
Marcus Shawcroft ce1406ffbb drivers/gpio_nrf5: Make driver_api structure const.
Change-Id: Ib7d3bbf02ff32972d0e86f0d24649281480603ae
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:25 +00:00
Marcus Shawcroft e0fed5f219 drivers/gpio_k64: Make driver_api structure const.
Change-Id: I39fd54c0e5daaa40a28a61dba51e22c649608c7b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:24 +00:00
Marcus Shawcroft 19129d6e96 drivers/gpio_dw: Make driver_api structure const.
Change-Id: I17199a0408f4a6bb8d7d647cf4ed54c6b8a91245
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:24 +00:00
Marcus Shawcroft b592cdf685 drivers/gpio_atmel_sam3: Make driver_api structure const.
Change-Id: I7294efcc0251bfe31add9233f07a2584f2edb49a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:23 +00:00
Marcus Shawcroft 6ae68cc36a drivers/eth_enc28j60: Make driver_api structure const.
Change-Id: I7b479bc1ab5805f83bf880d5db3db8f4fad52e1d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:23 +00:00
Marcus Shawcroft da7a00b407 drivers/dma_qmsi: Make driver_api structure const.
Change-Id: I5436711dfc051916839080b79659c88fca7dd586
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:22 +00:00
Marcus Shawcroft 960565269a drivers/stm32f10x_clock: Make driver_api structure const.
Change-Id: I7d8fb922b9ea0d11c48f61004138a166b9eb4d98
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:22 +00:00
Marcus Shawcroft fece918846 drivers/nrf5_power_clock: Make driver_api structure const.
Change-Id: Ibac214beb850b74746b5315695beb543a7c0bd76
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:22 +00:00
Marcus Shawcroft df4c5d7f0c drivers/ti_adc108s102: Make driver_api structure const.
Change-Id: Ib3ba23270f18f99eefdf7181bb3a06930ca535ad
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:21 +00:00
Marcus Shawcroft 223e36bea7 drivers/adc_qmsi_ss: Make driver_api structure const.
Change-Id: Idb7196cac4e7be1bf9819989634046b8c289f8c5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:21 +00:00
Marcus Shawcroft 4303d74220 drivers/adc_qmsi: Make driver_api structure const.
Change-Id: I1666b9130b36fa470cdc496fb96747cbb0e52ce7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 18:45:20 +00:00
Carles Cufi 33d17497d2 drivers: uart_nrf5: Use MDK baudrate divisor constants
The baudrate calculation present in set_baudrate() is
causing the UART to emit inital bytes incorrectly, for a
reason currently unknown, but directly related to the fact
that __aeabi_uldivmod is being invoked.
Since the nRF5x Product Specifications do not provide a
standard formula to calculate baudrates and instead list
a predefined set of divisor values, we opt here to use the
official values and remove the attempt at calculating them
manually.

Change-Id: Ic3ff42ea6d065e9a1d26a5350ce5bf5ad661160a
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-25 18:40:56 +00:00
Qiu Peiyang 2901f89170 drivers/pwm: fix pwm_qmsi_set_values() return error
When user wants to set all the PWM ports in one call,
pwm_qmsi_set_values() should call __set_one_port() for
each PWM port. The current pwm_qmsi_set_values() will
return after setting the first PWM port. It's illogical.

Change-Id: I5776bf636c2dc58683c629e26f72fca335e781db
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-10-25 13:05:18 +00:00
Marcus Shawcroft 1bc999cb8d drivers/uart: Refactor UART input hook.
This refactor is in preparation for making driver API structures
const.

The console driver provides a mechanism to install an input and an
output hook function.  These are primarily used by the onboard
gdb-server.  The output hook is entirely implemented within the
console driver.

The input hook is partially implemented in the top of the uart driver
and within the console driver.  The hook function itself is installed
in the uart API structure, but is invoked only by the console driver.

Installing the hook function directly into the uart API structure
prevents the API structure being const.  There are two approaches to
fixing this:

1) Implement setting of the input hook in the same way as
uart_irq_callback_set().

2) Move the input hook entirely to the console driver.

We implement the latter.  This approach has two benefits, first it
removes the need for every uart driver to implement the behaviour and
second, the current placement of the callback function in the uart API
seems odd given that the callback is only invoked by the console
driver, never by a uart driver.

Change-Id: I258b312d3055df1c2bdeb896bd4f4f39c40838f7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 11:31:08 +00:00
Anas Nashif da5e7d7fa0 grove: fixed log level kconfig variable
The variable is defined as SYS_LOG_GROVE_LEVEL in Kconfig..

Change-Id: I0f77336df2293694ece71f4f5fccb5283f6dc58c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-25 10:42:32 +00:00
Ricardo Salveti c7e607656b flash/nrf5: support non word-aligned write
Change-Id: Ia63344dcfd4a5c44c97c54101684cbba720f0103
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-25 00:34:28 +00:00
Marcus Shawcroft 681a4df787 th02: Limit name space pollution by using 'static'
The name read16() collides with other definitions within Zephyr.  We
don't actually use this function here, so remove the definition.  Fix
various other unnecessary name exports while we are here by adding
'static'.

Change-Id: I7eee8c527a62fea4e6e1bdae8a4874d8ce66596c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-24 20:10:15 +00:00
Marcus Shawcroft abefffeda6 hdc1008: Limit name space pollution by using 'static'
The read16() name collides with other definitions within zephyr.  Make
it static and fix a few other unnecessary name exports while we are
here.

Change-Id: Id72d44a6b84b8d72c7ba2d0f34b29dbc1d02f2b6
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-24 20:10:15 +00:00
Johan Hedberg b1d5ae72e3 drivers/serial: Make nRF5 UART pin configuration board-specific
The exact pin numbers for the nRF5 UART configuration is
board-specific, so the Kconfig default values should be in a
board-specific file.

Change-Id: Ibaacde292db191221e32b3626c68bf972dd26016
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-24 15:04:46 +00:00
Dmitriy Korovkin 792140a502 drivers: Fix type problems when building QMSI rtc driver
In order to avoid type conflicts make sure that ISR_HANDLED
is defined. This makes the ISR the correct type.
Make sure that the pointer for the unused argument for ISR
is of the proper type (NULL).

Change-Id: Ia1873f32d2e2174085f929e318a780a1b2574785
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-10-22 01:27:02 +00:00
Dmitriy Korovkin dc76dbf2ef unified: Add tickless idle support for ARC
Change-Id: I89684e7bee379be0a18f64e4f2c39ae132fe7e6d
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-10-22 01:27:01 +00:00
Ricardo Salveti 26730bec6b Bluetooth: Controller: Make radio compatible with the nRF51 series
Isolate nRF52 specific configurations.

Change-Id: Icde32dc5e2c1753684e4c6bf39a5649652cdb8d0
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-22 01:25:56 +00:00
Ricardo Salveti f2fb64b075 drivers/gpio/nrf5: change default IRQ_PRI
Make default value compatible with both nRF51 and nRF52.

Change-Id: I65dafbdf8518103becdd7388e9c0195ef1c4460d
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-22 01:25:55 +00:00
Ricardo Salveti 7124d95795 serial: make nrf5 driver compatible with nrf51
Default IRQ priority changed to 1 to so it can also be compatible with
nRF51 (Cortex-M0 allows up to 4 priority levels but Zephyr needs the
first two for the OS).

Change-Id: Ie57a729f5d932f020a7d1d7e55cf3741f1ecfbab
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-22 01:25:54 +00:00
Ricardo Salveti 69b9451af1 arm/nordic: use a common header for the nrf51/nrf52 SoC families
Integrating the IRQ definitions for both nRF51 and nRF52, and defining
the set of IRQ values that are common to both.

Also switch the controller, uart and clock drivers to use the common
header definitions.

Change-Id: Id6816d7a97720896cfe4df83656fb8b1f8fb01fa
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-22 01:25:54 +00:00
Anas Nashif bce6b337a5 Merge "Merge bluetooth branch into master" 2016-10-21 22:12:23 +00:00
Tomasz Bursztyka cc54803d9e drivers: ieee802154: Fix register name
It's not FMSTAT<0/1> but FSMSTAT<0/1>

Change-Id: I836cf001b7baefe86df67f13a8759ea4e697a28e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-10-21 17:03:57 +00:00
Iván Briano 5a76185655 i2c qmsi: Fix enabling of the clock at driver init
Put the clk_perih_enable() call outside of the switch statement so it
actually runs.

Jira: ZEP-1048

Change-Id: Iee8efb4430d37dc74ce48f249bbf58d53125b520
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-10-21 16:53:42 +00:00
Vinayak Chettimada a1c139eb84 Bluetooth: Controller: Remove custom clock control impl.
As part of an effort to closely integrate with Zephyr OS,
removed the custom implementation of clock control
interfaces used in controller code and use the driver model
in Zephyr OS.

Jira: ZEP-897

Change-id: I03efbff471e42b9bd9832818dd20dd5998a60227
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-10-21 07:47:31 +03:00
Luiz Augusto von Dentz ee9f5c1784 Bluetooth: GATT: Pass CCC attribute to changed callback
This way the application can reuse the same callback for multiple CCC
since it can track what CCC is affect by checking the attribute pointer.

Change-Id: I608da643aea07de26b65d67e6db3268d717d0f53
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-21 07:47:31 +03:00
Vinayak Chettimada c41d3edda8 Bluetooth: Controller: Alternate Enc procedure for nRF51x SoC
nRF51x SoC is based on ARM Cortex-M0 and running at 16MHz clock.
Due to Radio ISR latency restriction, the CPU utilization within
BLE tIFS of 150 us should not be more than the time radio h/w
takes to get ready. In order to keep short CPU utilization
inside tIFS encryption procedure has been spread over several
connection intervals. In comparison to possible encryption setup
in 3 connection intervals, this commit introduces a encryption
setup being done in 5 connection intervals so that max. CPU time
is well within the permissible limits by nRF51 h/w and tIFS.

Change-Id: I8971d69675836b9e18bea59d95951e0dfe8a7d2d
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-10-21 07:47:31 +03:00
Marcus Shawcroft bad9aa1501 uart/ns16550: Make driver config_info structure const.
Change-Id: I57c71df60dfcfee1ea6bf461777775b928a61c1b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:49:01 +00:00
Marcus Shawcroft b1d9647595 uart/nrf5: Make driver config_info structure const.
Change-Id: Ic601560c187a35b9087e058957f426fb92a1d761
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:49:00 +00:00
Marcus Shawcroft 5acbdcc34e uart/altera_jtag: Make driver config_info structure const.
Change-Id: I22b128f1b43dd081e8c9fc9473f8ba3752d4ad5d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:49:00 +00:00
Marcus Shawcroft c7b0aaeb07 sensor/lsm9ds0_mfd: Make driver config_info structure const.
Change-Id: I1c8790feda28ccd29f9c3df1579b596dec7ee663
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:59 +00:00
Marcus Shawcroft 78f07b2b9a sensor/lsm9ds0: Make driver config_info structure const.
Change-Id: I126f0c8f2e8ecfa43740d70464f2829197000ef1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:59 +00:00
Marcus Shawcroft 515443f154 sensor/lsm6ds0: Make driver config_info structure const.
Change-Id: I2bb46ce28d5a74e152106301f358878cd8edc03b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:59 +00:00
Marcus Shawcroft 5cafbed740 sensor/lps25hb: Make driver config_info structure const.
Change-Id: I30af3ff45c1b12a6c9392a021d8ef6bfcaa53772
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:58 +00:00
Marcus Shawcroft 3b678f53fe sensor/bmi160: Make driver config_info structure const.
Change-Id: Ia4f5333f9440712224f07a517229f7d3b2dd92f7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:58 +00:00
Marcus Shawcroft 4577987ba7 sensor/bmg160: Make driver config_info structure const.
Change-Id: If39f09baa757623ea9ed550df0809b863b1cb8a2
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:57 +00:00
Marcus Shawcroft 07fd1b7746 sensor/bmc150: Make driver config_info structure const.
Change-Id: I375b8b08811c21a888d49e2b98c6a7a056520ce4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:57 +00:00
Marcus Shawcroft caa6bf3419 pwm/pca9685: Make driver config_info structure const.
Change-Id: I1bb5a5502c0d2e643c8fb82540a3e94ea7d5d46f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:57 +00:00
Marcus Shawcroft 12810d7e54 pwm/ftm: Make driver config_info structure const.
Change-Id: I14ff0d15ea2b2da08ac4dd60fb4b477e9e51d8aa
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:56 +00:00
Marcus Shawcroft 6e05001c4d uart/k20: Make driver config_info structure const.
Change-Id: I7e13eb1f75d19e15fb3617687e50e06639808fda
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:56 +00:00
Marcus Shawcroft e75a953650 uart/qmsi: Make driver config_info structure const.
Change-Id: Ia89250aa54409cf6121f48a413e97b68e34d0b26
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:55 +00:00
Marcus Shawcroft b21a933366 uart/stellaris: Make driver config_info structure const.
Change-Id: Ic28bad8f474948127e69509ad7c494de92ba7c77
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:55 +00:00
Marcus Shawcroft 8718815ce5 uart/stm32: Make driver config_info structure const.
Change-Id: I7be12afc5b55f6a02dd2fba2896f293e7ef0eec4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:54 +00:00
Marcus Shawcroft bcdc0d2af6 shared_irq: Make driver config_info structure const.
Change-Id: I58e836d77c847dbaef2eed5fd66e7bd1ef1ef303
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:54 +00:00
Marcus Shawcroft 1385a65b82 spi/dw: Make driver config_info structure const.
Change-Id: I76e60e1a412a25c9a86d749cdd0b558164381050
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:53 +00:00
Marcus Shawcroft 5e2b549cb4 spi/intel: Make driver config_info structure const.
Change-Id: Ic4f44cf375a27fbd50175673ab3f0f064faadf15
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:53 +00:00
Marcus Shawcroft 84e805c78c spi/k64: Make driver config_info structure const.
Change-Id: I82a382b7240d75ce8479565680b72f93a8cb5997
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:53 +00:00
Marcus Shawcroft d1dabe27f4 spi/qmsi: Make driver config_info structure const.
Change-Id: I6d593c3a1af4fdfb6dd855872383165cb6b8142d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:52 +00:00
Marcus Shawcroft eef251bba9 spi/qmsi_ss: Make driver config_info structure const.
Change-Id: Id2cf7b88cc05b42600828c32f36e5821eb764821
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:52 +00:00
Marcus Shawcroft ba30e3e59e i2c/qmsi_ss: Make driver config_info structure const.
Change-Id: I3718c34cc4cc7e70256321736b0981c147f319f5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:51 +00:00
Marcus Shawcroft a4dd8e91d1 i2c/qmsi: Make driver config_info structure const.
Change-Id: Ic31f40c48a71fdc3a1745ee5685cc14fdbb7527b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:51 +00:00
Marcus Shawcroft 49b0face1e i2c/ksdk: Make driver config_info structure const.
Change-Id: I605ab6f33222c11e8f336e1a981615e7b0c6cefa
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:51 +00:00
Marcus Shawcroft 72a70fa224 i2c/dw: Make driver config_info structure const.
Change-Id: I66ac4cf010affc6193d1d74dec8dc25e69454438
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:50 +00:00
Marcus Shawcroft 6919ef179e i2c/sam3: Make driver config_info structure const.
Change-Id: Idf49d5b5663f5e0375b7ea23e056d0465f32abce
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:50 +00:00
Marcus Shawcroft b33e59dc02 gpio: stm32: Make driver config_info structure const.
Change-Id: I05c844794c29225a6dd6462d512d470a687ac3a5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:49 +00:00
Marcus Shawcroft c351093177 gpio: sch: Make driver config_info structure const.
Change-Id: I04598162c92991f8e98343746802a82c98f8eb83
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:49 +00:00
Marcus Shawcroft a40c211ed3 gpio: qmsi_ss: Make driver config_info structure const.
Change-Id: Ibfcb3e7f78f4ac777a72647446cebec1d26a116f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:48 +00:00
Marcus Shawcroft 213988873b gpio: qmsi: Make driver config_info structure const.
Change-Id: Ia2d840685db19493a0d2eee874b81dd968ee93b3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:48 +00:00
Marcus Shawcroft cbbc1c4da2 gpio: pcal9535a: Make driver config_info structure const.
Change-Id: Id484d8d3fd9212b82f6d623201506268759ccfc8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:48 +00:00
Marcus Shawcroft 4c727dbc10 gpio: nrf5: Make driver config_info structure const.
Change-Id: Ie831403c15f344f6bf83c7b00ca0c73185053f4d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:47 +00:00
Marcus Shawcroft 589a77f57a gpio: dw: Make driver config_info structure const.
Change-Id: Ib80fa277bba38c05e00817e6e6071c0b4db38a66
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:47 +00:00
Marcus Shawcroft 1653d90cbf gpio: sam3: Make driver config_info structure const.
Change-Id: I366a8096e61f2c9f6481fdbb83ba4257c94bddae
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:46 +00:00
Marcus Shawcroft b8f0de0e43 eth: enc28j60: Make driver config_info structure const.
Change-Id: Ib36cc9a2a1e72539196803d4a0bf61453d1a4b25
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:46 +00:00
Marcus Shawcroft df4b8d3915 eth: dw: Make driver config_info structure const.
Change-Id: I4b3a86c29c28cee09547973e85ea55489c5cc489
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:45 +00:00
Marcus Shawcroft 6d97853a6b dma: qmsi: Make driver config_info structure const.
Change-Id: I73f6e5de1de1ec61265cfe697d70ae1441663f41
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:45 +00:00
Marcus Shawcroft d0a71d8f77 adc: Make driver config_info structure const.
Change-Id: Ide974b66da3b785c676f5bbd4f3f5f248797c4e5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:45 +00:00
Marcus Shawcroft aeac8e633b serial/sam3: Make config_info structure const.
Change-Id: I7aa0ea803c00644c84952fcd6e3ddcd3e41607f6
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:44 +00:00
Marcus Shawcroft 24fe3a0b3d gpio: k64: Make driver config_info structure const.
Change-Id: Ib471bbe2de7de232331bba97570655b262bdac81
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-20 16:48:44 +00:00
Kumar Gala 89f71ba0e2 stm32: cleanup how we get external interrupt base addr
Move to utilizing an inline function for getting the base addr of the
external interrupt register region.  This is in prep for support more
than 32 external interrupts.

Change-Id: Ifdaad67703068395a7749543ef68435435e7c9ba
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-20 12:18:41 +02:00
Bogdan Davidoaia f0bc96ee8c sensor: hdc1008: add missing dependency for I2C address config
The HDC1008_I2C_ADDR config option should be available only if HDC1008
is enabled.

Change-Id: I0d1813512396faefb609527ba5df2a0c4ea159a9
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-10-20 09:44:40 +00:00
Anas Nashif 71d6ad2619 sensors: bmi160: remove unused init priority config
Change-Id: I367d7b084fb93609000066b610e01a802fdd152e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-20 09:39:51 +00:00
Genaro Saucedo Tejada 78316bd8c7 fix: Add missing structure at spi_intel_resume_from_suspend
Change e4b89571aa renamed the variable
to an undeclared one, without breaking verify but daly breaks.

A local variable of type spi_intel_data was missing on this
function.

Jira: ZEP-1095

Change-Id: Ie410933c2472378d4a6f24d6ca932ac203e3b08c
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-10-19 21:22:41 +00:00
Marcus Shawcroft 58ed60457c pwm/dw: Make config_info pointers const.
Mutable driver state relocated from config_info to driver_info.

This driver is unused by any board, nor can it be compiled for any
board.  Hence this patch reflects the mechanical change that should be
made to the driver in order to support a const config_info, but the
patch has been neither compiled, nor tested.

Change-Id: I28597962e81d6e02f1f4befe48c3a3324691cfeb
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-19 12:10:59 +00:00
Marcus Shawcroft fded21ab45 eth/dw: Move RW objects from device config_info to device driver_data.
Mutable driver state relocated from config_info to driver_info.  This
driver supports PCI enumeration.  We drop code that attempts to update
irq_num based on PCI enumeration because the interrupt found by PCI
enumeration must always be the same as the statically configured IRQ
number.

Change-Id: I5580b0ba95635696a825fe66dbf16259c54d5ba8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-19 12:10:59 +00:00
Marcus Shawcroft 8564334254 gpio/dw: Move RW objects in config_info to driver_data
PCI enumeration modifies pci_dev and base_addr at driver
initialization therefore these objects move from config_info to
driver_data in preparation for config_info becoming const.

We drop code that attempts to update irq_num based on PCI enumeration
because the interrupt found by PCI enumeration must always be the same
as the statically configured IRQ number.

Change-Id: Ibfefa851d2836d524b8151ed0108ecf9de2cd3a3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-19 12:10:58 +00:00
Marcus Shawcroft beb05f8661 i2c/dw: Move RW objects in config_info to driver_data
PCI enumeration modifies pci_dev, base_addaress at driver
initialization therefore this objects move from config_info to
driver_data in preparation for config_info becoming const..

We drop code that attempts to update irq_num based on PCI enumeration
because the interrupt found by PCI enumeration must always be the same
as the statically configured IRQ number.

Change-Id: Id5af682dac112ec6dc6e4aa14b655e0047972d38
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-19 12:10:58 +00:00
Marcus Shawcroft e4b89571aa spi/intel: Move RW driver context from config to runtime structure.
Mutable driver state relocated from config_info to driver_info.  This
driver supports PCI enumeration.  We drop code that attempts to update
irq_num based on PCI enumeration because the interrupt found by PCI
enumeration must always be the same as the statically configured IRQ
number.

Change-Id: I97198ae9603505606a872b07824d6c61688f0ced
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-19 12:10:58 +00:00
Ricardo Salveti b035209080 drivers: exti_stm32: fix clear pending exti
Pending bit gets cleared by writing 1 into it, so don't use the previous
value and just write the line bit offset instead.

Change-Id: I4c88016bf53327b2670a144d3b994945f26fc002
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>¬
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-10-19 11:56:00 +00:00
Ricardo Salveti 17a62dd268 exti: stm32: fix driver data handling
Since dd5e90ec the device_get_binding call returns NULL unless the
driver_api is set by the driver. Since the exti driver only uses an
internal struct to store the callbacks, remove the need for the device
binding call from other drivers (e.g. gpio).

Change-Id: If0b733c27754108118d87ef02640311f0535ab57
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-10-19 11:56:00 +00:00
Amit Kucheria 4c2802d6b7 drivers: serial: uart_stm32: Fix typo in register field name
The field is "NF: Noise detect flag". Given that every other field name is
faithful to the manual, do the same for NF.

Change-Id: I300663e6d5016bf28071d2a1926ec73682ae3d01
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-10-19 11:55:59 +00:00
Jesus Sanchez-Palencia 13b5d62625 rtc: Set prescaler to QMSI shim
In QMSI 1.2 API, the RTC divider value for the prescaler can now be set
on runtime. This is done through a config parameter for the qm_rtc
driver.

Fix the rtc shim driver by using the value defined in rtc.h as
RTC_DIVIDER.

Change-Id: I5ab61a5a1a3debca103f2782e0ac584938dc91e1
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-10-18 23:26:02 +00:00
Jesus Sanchez-Palencia 7c0fc99c79 ext qmsi: Update to QMSI 1.2 release
Update the QMSI drop we maintain in Zephyr, and fix the build where
needed:

- QM_USB_BASE is renamed to QM_USB_0_BASE;
- parameter int_en from qm_uart cfg struct was removed;
- driver's folder now has a new structure, fix makefiles accordingly;
- QM_WDT_MODE and related renamed to QM_WDT_CR_RMOD;
- QM_SCSS_AON renamed to QM_AONC.

Change-Id: Iffe9c66b7a3f2fe64418326e20ff0894149b3044
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-10-18 23:26:01 +00:00
Maureen Helm 56c094570e pinmux: Add hexiwear pinmux table
The hexiwear board has a k64 SoC, so we can reuse the k64 pinmux driver
and just add a new pinmux table for the board.

Jira: ZEP-716
Change-Id: I936691b3578db298014f44fe18433d7943b431f3
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-18 21:42:32 +00:00
Maureen Helm 342e09c463 pinmux: Rename frdm_k64f pinmux driver to k64
The k64 pinmux driver can be used for any k64 board, not just frdm_k64f,
therefore renaming the driver accordingly.

Change-Id: I45e96d4a5ff6aa859d0f57fe098e44a8ae5283d1
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-18 21:42:31 +00:00
Anas Nashif debf5bfe63 pinmux: k64f: remove unused Kconfig section
Those options are not being used anywhere, so remove them and avoid some
confusion.

Change-Id: Ia3767dbd2432851dfae4b1e996f02ed1b2450505
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-18 20:14:52 +00:00
Justin Watson b5e9c6d1bb driver: Fixed Atmel SAM3 serial driver.
The Atmel SAM3 serial driver poll in function checked
for new characters incorrectly.

Change-Id: I9024a991404bf949226634c9f6c6ea507577cff1
Signed-off-by: Justin Watson <jwatson5@gmail.com>
2016-10-18 17:46:41 +00:00
Vinayak Chettimada 5843e8df89 drivers: clock_control: Add nRF5x Series SoC clock driver
In the Nordic Semiconductor's nRF5x series SoC clock control
system can source the system clocks from a range of internal or
external high and low frequency oscillators and distribute them
to modules based upon a module’s individual requirements.
In this commit the implementation adds support for 16MHz
peripheral clock, 32.768 kHz RC oscillator, and 32.768 kHz
crystal oscillator clock sources.

16MHz peripheral clock is required to use the 2.4GHz Radio
peripheral. 32.768 kHz RC or crystal oscillator clock source
is required to use the real time counter peripheral.

Jira: ZEP-896

Change-id: I1a1e22322a5a26b587f3e27bb979e6296987ac1c
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-10-18 13:03:41 +00:00
Anas Nashif 348e61dcdc sensors: tmp112: move tmp112 to own directory under drivers/sensor/
Change-Id: I85023f60ee3c5303a6c065f8ee1b238106b13e49
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 14:49:56 -04:00
Anas Nashif 623b43f5dc sensors: tmp007: move tmp007 to own directory under drivers/sensor/
Change-Id: If5fd1277ec93455ee7a1e856357dfab0930a653c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 14:41:21 -04:00
Anas Nashif bdfeda0a73 sensors: sx9500: move sx9500 to own directory under drivers/sensor/
Change-Id: Ifc7dfd8a28d33f140415ca178b56d35e51aff178
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 14:39:56 -04:00
Anas Nashif b918ae8d82 sensors: sht3xd: move sht3xd to own directory under drivers/sensor/
Change-Id: I8d13f5b2461169940f24a08346f0da0c291a8fef
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:38:00 +00:00
Anas Nashif cce03b127d sensors: mpu6050: move mpu6050 to own directory under drivers/sensor/
Change-Id: Ia0c4e81f8725da6fc5fead7a86320b613336e702
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:59 +00:00
Anas Nashif 6977cad1e2 sensors: mcp9808: move mcp9808 to own directory under drivers/sensor/
Change-Id: I8327d821b95b5bd8c13d5f24dd5ec46fa53b2d18
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:59 +00:00
Anas Nashif 77bbbb3618 sensors: max44009: move max44009 to own directory under drivers/sensor/
Change-Id: I6b063ebeb53ce6ababd027e15d8d7d94f6174a53
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:59 +00:00
Anas Nashif 109cfe5889 sensors: lsm9ds0_mfd: move lsm9ds0_mfd to own directory under drivers/sensor/
Change-Id: If07b2a73a8acad7f89f650ec304199961a629e28
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:58 +00:00
Anas Nashif 81c564a675 sensors: lsm9ds0_gyro: move lsm9ds0_gyro to own directory under drivers/sensor/
Change-Id: Ia654ab8059d656da6b4414a3fe35c81ec39654d3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:58 +00:00
Anas Nashif 1ae2b855c1 sensors: lsm6ds0: move lsm6ds0 to own directory under drivers/sensor/
Change-Id: Ia2911f584da30fd583318e9730ad1ec147ba6f8b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:57 +00:00
Anas Nashif 8298e9ac27 sensors: lps25hb: move lps25hb to own directory under drivers/sensor/
Change-Id: I5d9c802a8ec9d29557417b687c92b2430aca9fe1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:57 +00:00
Anas Nashif 49f53fa3ac sensors: lis3mdl: move lis3mdl to own directory under drivers/sensor/
Change-Id: Ie3140e7eb6dcfab6008af3ba85dc9119c5dbfb50
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:56 +00:00
Anas Nashif 6f0c55600a sensors: lis3dh: move lis3dh to own directory under drivers/sensor/
Change-Id: Ie263f4400707fec685cd93077e764c5b77f4784d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:56 +00:00
Anas Nashif bdcf651cd1 sensors: isl29035: move isl29035 to own directory under drivers/sensor/
Change-Id: Ia0164f2891b1b2f3d19c63b8311d71e1f9abeeb5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:56 +00:00
Anas Nashif cc43b3017a sensors: hts221: move hts221 to own directory under drivers/sensor/
Change-Id: Id568ee3fae62090ef2711d34fbfd9de214630008
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:55 +00:00
Anas Nashif e71a133dd7 sensors: hp206c: move hp206c to own directory under drivers/sensor/
Change-Id: Ie218228c16584384312200522f43edbd15aadf30
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:55 +00:00
Anas Nashif 4166365c00 sensors: hmc5883l: move hmc5883l to own directory under drivers/sensor/
Change-Id: I5b1126238686b239a5abb73d3ddc966e7d7150d3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:54 +00:00
Anas Nashif 37cf07df27 sensors: hdc1008: move hdc1008 to own directory under drivers/sensor/
Change-Id: If1a7805ab2053b3588318c2a3d5b549a667cb0fb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:54 +00:00
Anas Nashif 9078ad7982 sensors: dht: move dht to own directory under drivers/sensor/
Change-Id: Id19b4ea414347caa23730e3ccd4f79761878af01
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:53 +00:00
Anas Nashif 49a6d13849 sensors: bmi160: move bmi160 to own directory under drivers/sensor/
Change-Id: I14bfabf77b7aa64acbf25a922a94f92c559b13f7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:53 +00:00
Anas Nashif 0005f2ff06 sensors: bmg160: move bmg160 to own directory under drivers/sensor/
Change-Id: Ifae44714f08537835c8466fba11b6853f258f148
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:53 +00:00
Anas Nashif c445de3bbb sensors: bme280: move bme280 to own directory under drivers/sensor/
Change-Id: I53f5504773c914b0936091c459b80ab133b9e4ac
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:52 +00:00
Anas Nashif 57b13ec890 sensors: bmc150_magn: move bmc150_magn to own directory under drivers/sensor/
Change-Id: I725438747b3208ebd49f4f7d9ef6277721eaa48f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:52 +00:00
Anas Nashif c31bbc32d8 sensors: bma280: move bma280 to own directory under drivers/sensor/
Change-Id: I1c73d36a51ea88fbda3707c7d6630d54f8fd3545
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:51 +00:00
Anas Nashif db04446964 sensors: ak8975: move ak8975 to own directory under drivers/sensor/
Change-Id: Ib3a8e8a74430d30843db77954737c3ce5dfdce14
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 18:37:51 +00:00
Anas Nashif 2f042d65a0 grove lcd: cleanup includes
Change-Id: If9c7b505c1233c8e86bc3142ac803dc1a5ac5272
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 00:24:34 +00:00
Anas Nashif 915eac4625 sensors: add TH02 temperature sensor (Grove)
Support for the Temperature&Humidity Sensor (High-Accuracy &Mini)
v1.0 sensor, see:

http://wiki.seeed.cc/Grove-TemptureAndHumidity_Sensor-High-Accuracy_AndMini-v1.0/

Change-Id: I439eafc863116f21e3b3385175d1935e60a5e9b1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-17 00:24:33 +00:00
Johan Hedberg efe7c939c2 Merge bluetooth branch into master
Main changes:

 - Fixes to IPSP & L2CAP buffering to prepare for Native IP stack
 - Fixes to SMP (Security Manager Protocol) over BR/EDR
 - Improvements to persistent storage API
 - Support for specifying BR/EDR Page Timeout in Kconfig

----------------------------------------------------------------
Flavio Santes (1):
      Bluetooth: Fix Kconfig typo

Itankar, Piyush T (3):
      Bluetooth: HCI: Add OpCode definition for setting page timeout
      Bluetooth: Kconfig: Option to set page timeout value
      Bluetooth: HCI: Set the Page timeout

Johan Hedberg (7):
      Bluetooth: Use proper const type for bt_storage_clear()
      Bluetooth: Improve storage API documentation
      Bluetooth: Add BT_STORAGE_ADDRESSES key to storage API
      Bluetooth: samples/btusb: Rename main c-file
      Bluetooth: samples: Rename btusb to hci-usb
      Bluetooth: SMP: Take advantage of new byte swap helpers
      Bluetooth: tests: Clean up platform whitelisting

Luiz Augusto von Dentz (4):
      Bluetooth: L2CAP: Fix sending buffer with not enough space
      Bluetooth: L2CAP: Allow sending fragmented buffers
      Bluetooth: L2CAP: Allow receiving fragmented buffers
      Bluetooth: IPSS: Remove ipss_listen

Mariusz Skamra (3):
      Bluetooth: tester: Rework discovery procedure
      Bluetooth: tester: Add Identity Resolved event implementation
      Bluetooth: tester: Add GAP Unpair command handler

Roger Lendenmann (1):
      Bluetooth: Add well known keys to storage API for legacy pairing

Szymon Janc (13):
      Bluetooth: L2CAP: Initialize iterator inside for statement
      Bluetooth: L2CAP: Build fixed channels mask on runtime
      Bluetooth: L2CAP: Move BR/EDR specific code to l2cap_br.c
      Bluetooth: L2CAP: Connect optional fixed channel only if supported
      Bluetooth: L2CAP: Treat fixed channel as connected on incoming data
      Bluetooth: SMP: Fix getting context for BR/EDR pairing
      Bluetooth: SMP: Use separate pool for BR/EDR connections
      Bluetooth: Start SMP over BR/EDR on pairing complete
      Bluetooth: SMP: Fix build without central role support
      Bluetooth: SMP: Fix build without signing support
      Bluetooth: tests: Add init config for BR/EDR SMP testing
      Bluetooth: Track role change for BR/EDR connections
      Bluetooth: SMP: Check for connection role before BR/EDR pairing

 drivers/bluetooth/nble/gap.c                      |   2 +-
 include/bluetooth/hci.h                           |   9 +
 include/bluetooth/storage.h                       |  55 +++-
 net/bluetooth/Kconfig                             |  10 +-
 net/bluetooth/hci_core.c                          |  57 +++-
 net/bluetooth/l2cap.c                             | 119 ++++++---
 net/bluetooth/l2cap_br.c                          | 117 +++++++--
 net/bluetooth/l2cap_internal.h                    |   3 +
 net/bluetooth/smp.c                               | 259 +++++++++++--------
 net/bluetooth/smp.h                               |   2 +
 samples/bluetooth/gatt/ipss.c                     | 121 ---------
 samples/bluetooth/gatt/ipss.h                     |   1 -
 samples/bluetooth/{btusb => hci-usb}/Makefile     |   0
 samples/bluetooth/{btusb => hci-usb}/prj.conf     |   0
 samples/bluetooth/{btusb => hci-usb}/src/Makefile |   2 +-
 .../{btusb/src/btusb.c => hci-usb/src/main.c}     |   0
 samples/bluetooth/{btusb => hci-usb}/testcase.ini |   0
 samples/bluetooth/ipsp/src/main.c                 | 121 ++++++++-
 tests/bluetooth/init/prj_22.conf                  |   5 +
 tests/bluetooth/init/testcase.ini                 |   9 +-
 tests/bluetooth/tester/btp_spec.txt               |   8 +
 tests/bluetooth/tester/src/bttester.h             |   9 +
 tests/bluetooth/tester/src/gap.c                  | 182 ++++++++++++-
 23 files changed, 780 insertions(+), 311 deletions(-)
 rename samples/bluetooth/{btusb => hci-usb}/Makefile (100%)
 rename samples/bluetooth/{btusb => hci-usb}/prj.conf (100%)
 rename samples/bluetooth/{btusb => hci-usb}/src/Makefile (86%)
 rename samples/bluetooth/{btusb/src/btusb.c => hci-usb/src/main.c} (100%)
 rename samples/bluetooth/{btusb => hci-usb}/testcase.ini (100%)
 create mode 100644 tests/bluetooth/init/prj_22.conf

Change-Id: Ic85dc1773947ce6229fe8364a81ce9876bb1effb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-16 14:43:32 +03:00
Marcus Shawcroft 87077727bf eth: Add KSDK ENET driver.
Provide a network driver wrapped around the KSDK ENET and PHY
drivers.

The driver performs one shot PHY setup.  There is no support for PHY
disconnect, reconnect or configuration change.  The PHY setup,
implement via KSDK contains polled code that can block the
initialization thread for a few seconds.

There is no statistics collection for either normal operation or error
behaviour.

Origin: Original

Change-Id: Ia0f2e89a61348ed949976070353e823c178fcb24
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-16 09:57:35 +00:00
Johan Hedberg 7d0eef5f96 Bluetooth: Use proper const type for bt_storage_clear()
The bt_storage_clear() function doesn't modify the data behind the
addr parameter, so the pointer should be decared const.

Change-Id: Icce676f9df80bac26ba4877bb63752559a43339f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-16 09:00:57 +03:00
Marcus Shawcroft 7ee5ce75e9 serial/ns16550: Move RW objects from driver config to driver context.
PCI enumeration modifies pci_dev and port at driver initialization,
these objects move from config_info to driver_data in preparation for
config_info becoming const.

This driver shares a unified uart configuration structure with other
uart device drivers.  The structure uses 'union' and the preprocessor
to customize the structure to the drivers specific requirement.  There
appears to be no compelling reason why all the uart drivers should
share the same (customized) config_info structure.  In order to
re-organize the structure for this driver to get config_info const, an
ns16550 specific config structure is defined and the driver switched
over from the generic uart_config.

Change-Id: I31932d811f623a9370b69903114ae97b15d65886
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 16:44:06 +00:00
Marcus Shawcroft be6872f5ca spi/dw: Make config structure static.
Change-Id: I15236d62b330ffe2363fa438179fe1f79c168592
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 16:44:06 +00:00
Marcus Shawcroft df098b7012 ipm: Make config_info pointers const.
Change-Id: I616c215f98f57d74ba495959d220de6d38ada9d0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:23 +00:00
Marcus Shawcroft 9f308df473 pwm: qmsi: Remove RW data from driver config structure.
Move the RW channel_period object from the driver config structure to
the driver context.  Remove the now empty driver config structure.

Change-Id: I38df7877f1bfb9bb55bcd61e7f35cebb6e4916bd
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:23 +00:00
Marcus Shawcroft 2650747983 serial/uart_qmsi: Make pointers to config_info const.
Change-Id: I667315671aeb8eaa5a5f1e4157c804e9028793de
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:23 +00:00
Marcus Shawcroft 0f1d0d465b i2c/qmsi_ss: Make pointers to config_info const.
Change-Id: I7786f9c65e62eee27395d53b6e923dec6c13f1f4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:22 +00:00
Marcus Shawcroft 3d32b19726 i2c/qmsi: Make pointers to config_info const.
Change-Id: I95e17cda100c068bfd61e66c568b5adb6f58c42c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:22 +00:00
Marcus Shawcroft 6b7616698b qmsi/dma: Make config_info pointers const.
Change-Id: I6569049d06853355b73735bfddedc827e4764780
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:21 +00:00
Marcus Shawcroft b8d6ce241c qmsi/dma: Remove unused channel[] from config_info
Change-Id: Iab5f976c61674f6955d50a882911c790eba3fb21
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:20 +00:00
Marcus Shawcroft 2d1678c632 gpio/sam3: Move RW data from driver config to runtime.
The callback list within the driver config is updated dynamically
hence the list itself cannot be const.  Create a runtime context
driver data structure and relocate the callback list to the new
structure.

Change-Id: Ied20846e6a78e43967239afa7797456a9abd8548
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:19 +00:00
Marcus Shawcroft 389e606b06 i2c/sam3: Make config_info pointers const.
Change-Id: I5e388ff91430d052c84553a8cf9ece12cae29993
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-15 12:29:19 +00:00
Anas Nashif e05fa64f4c frdm_k64: spi: fixed wrong kconfig used in driver
Change-Id: I43f31562cdfa0b722907e5c6018e3e56d141ed4f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-10 21:26:30 +00:00
Marcus Shawcroft 02dcceef29 clock/quark: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I0337cb574d8bac0877643b2116920d4a0c08c8f3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-08 11:40:15 +00:00
Marcus Shawcroft ec7d259fa3 eth/enc28j60: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I75e51f396ce9dbe5d9f2339b551c142a5afcbfce
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-08 11:40:13 +00:00
Marcus Shawcroft 3316cb3898 serial/uart_nsim: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Ide7c5cae8c57e3b30c7bb6611b574b86562c241d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-08 11:40:12 +00:00
Marcus Shawcroft 5e95f11afe spi/qmsi: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: I1ca9e999840a6ad81dc369b56b1da554f3c1cb49
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-08 11:40:11 +00:00
Anas Nashif 33118f9212 sensor: grove: use global sensor init priority
Change-Id: Ie56ee7e4b267b4dc67026be4531834f550134969
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 20:53:29 +00:00
Marcus Shawcroft 67d6b592cf sensor/lsm9ds0_gyro: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I8fd83236ecf5357a0a192650a26e91045a6116a7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:34:01 +00:00
Marcus Shawcroft cfb5196f07 sensor/lsm9ds0_gyro: Fix failure to compile, undefined CONFIG_LSM9DS0_SENSOR_INIT_PRIORITY
Change-Id: Ibaeaa1a7df692c044310ba116285e1898d806d0e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:34:00 +00:00
Marcus Shawcroft dee749b213 sensor/lsm64s0: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: If977cc39bab3e838d1ff6d8de2cb4b667974ee17
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:59 +00:00
Marcus Shawcroft 6b552ef2a8 serial/uart_qmsi: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: I0257e242a2d3bc4e353a3477364a4d9a7fb72b82
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:58 +00:00
Marcus Shawcroft fb4cfcba14 spi/qmsi_ss: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: I71bcfa48b31934bc683a344d40bb03f5247bbbec
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:57 +00:00
Marcus Shawcroft fd212acac9 ipm/ipm_quark_se: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I4fb89ccee9cec3bdc1976a006e13afcd0bdc69a2
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:57 +00:00
Marcus Shawcroft 4e81f369c7 gpio/qmsi_ss: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I31abd3d5606b2b750da86d00e938db3988696c7f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:56 +00:00
Marcus Shawcroft db35cc6838 sensor/bmi160: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Ia4639d65ab4ee64a2ee0ba41677bab40894d65b4
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:55 +00:00
Marcus Shawcroft a6f681c782 sensor/bmg160: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I2e9b7e7e8245e60e66554b4d631d71a453cf7ffd
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:54 +00:00
Marcus Shawcroft 1ec5093c04 sensor/bmc150: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Ic4563561cff930533e920031767218023d4746b0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:53 +00:00
Marcus Shawcroft 58c8199aa6 sensor/lps25hb: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I9f510669710ae8fab897d4047e4d7324c3a84e00
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:52 +00:00
Marcus Shawcroft 6cfe874a0f sensor/lsm9ds0_mfd: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I3b781f09e15d57ae4d00c11d6b7a328b31bc25aa
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 20:33:51 +00:00
Anas Nashif 16c5416d70 sensors: use one single sys log config for sensors
Change-Id: I27aadd15ad0ebbaf6373591d52e63fe3f4560378
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 16:15:54 +00:00
Anas Nashif 84c9db39e7 gpio: reduce Kconfigs and use consistent name for GPIOs
Using AON for GPIO kconfigs is very specifc to quark se, there
is no need to make this special for this platform. Use the
existing scheme instead.

Change-Id: I946431490380dc0f537d6056277a94c9c9c80fed
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 16:15:07 +00:00
Anas Nashif 706f1b8bd8 drivers: gpio: i2c: make logging depend on SYS_LOG
Change-Id: Ia6af28598cf979f20e04cd2c74f3e75f4ae6630b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 14:15:24 +00:00
Anas Nashif e3706c98f3 sensors: cleanup duplicate includes
zephyr.h includes nanokernel.h which includes cpu.h, so make it
simple and just include nanokernel.h. zephyr.h should only be
included in applications.

Change-Id: I11a9ad8608d23af4f2a40a97eb71c09516c3399b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-07 14:07:26 +00:00
Marcus Shawcroft d8708d52bc adc/ti: Make driver config structure static.
Change-Id: Ie3ae8397624ee3b9aedbfbe61acbe5a17a2db0b0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft bad1a4b1da adc/ti: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: I2256c0f0bff5100e756709c9f99887af70bac661
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft 11258b1395 adc/dw: Make driver config structure static.
Change-Id: Ia094d1abda47ff5d2e05c3d97f9a377cb17d2ee7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft b28b59b617 adc/dw: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: I977979bc86830768101ab9a2ca1928823ae994df
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft 58026e327a ipm: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I8f2eb0f6dbd6f50e0d456ee329e3b00e4ce4b257
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft 4ed5a6e9b2 spi/k64: Make the driver configuration structure static.
Change-Id: I67a679106a0e0407c0d5da4593983fb83f732141
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft 7c29c68675 spi/k64: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I2c860eac392ff43faf9c91a18e58a82eb7c4f860
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft ca26e7bb13 gpio/k64: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I6562816828734da9c60fdfcd2ce510f55ed70416
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft 3924f46359 i2c/kdk: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Ifdef448b9b6899367d41bda2f492a8e9fbd0d483
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft 6ccce59eac grove/lcd_rgb: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I7fdf091d6c2c838210a3ecd6011179be40f0931c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft dc5b363065 serial/uart_k20: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I0132c6fb6a1db21d4b3e8a5926e10eb40428744b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft f686da5c11 gpio/qmsi: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I61733f055ac16997da93cc56fb46fb7a7436b473
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 08:05:50 -04:00
Marcus Shawcroft ca9a7932bd serial/uart_nrf5: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Id02596f2e35faa2e3ba2c0e0ffd7bbe8e5e92896
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:45 +00:00
Marcus Shawcroft 98d9c82994 serial/uart_nrf5: Remove duplicate sys_clk_freq initialization.
The drivers config structure initializer sets sys_clk_freq statically.
The runtime repeated setup of sys_clk_freq is superfluous, and
inconsitent with const driver config structures.

Change-Id: I115e2b70b193b567de83132f3984e48b2dded0a2
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 12:04:45 +00:00
Marcus Shawcroft c595f08bb3 serial/uart_stellaris: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: Iaee259f70918497fdfc8fd3ef3ab3d7c953daa22
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:44 +00:00
Marcus Shawcroft f34d5511d6 serial/uart_stm32: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: I8ecc10b50e23d2dbe987e3318bac09e235b1e1da
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:43 +00:00
Marcus Shawcroft 548e848c31 gpio/stm32: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I29d12bd240d9ff3279e5c13852835f2a8cc6abec
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:42 +00:00
Marcus Shawcroft 09df78fced shared_irq: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: Ia2203f134c8d11f52a91e6245e7bdbb26f5a9e92
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:42 +00:00
Marcus Shawcroft 05b929fb6d serial/uart_atmel_sam3: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I19352c2cc1eb7e27ba66e50112683c38da379e4a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:41 +00:00
Marcus Shawcroft 58d43022b1 serial/uart_altera_jtag: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I83b207e22f1a543479603735302872a5a4ff533e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:40 +00:00
Marcus Shawcroft f8ec3c8d33 gpio/sch: Make config_info pointers const.
Preparation for const driver configuration data.

Change-Id: I0f156346cc7ac5e1c317c3c6d07a53abb0b453a9
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:39 +00:00
Marcus Shawcroft 92591d66b7 spi/dw: Make config_info pointers const.
Make pointers to struct config_info const in prepration for a const
config_info.

Change-Id: I28789a7f1f26e4a0d499f5a89a567ae8c61eae51
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@gmail.com>
2016-10-07 12:04:39 +00:00
Marcus Shawcroft fccfbf2e21 sensor: Fix Kconfig LSM9DS0_MFD I2C slave address type
Change the Kconfig parameter type for the I2C slave address from
string to hex.  The code that consumes this configuration parameter
expects an integer and fails to compile when presented with a string.

Change-Id: I493002ea6f1266344cac863ac305e59e93a5b1fe
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-07 10:34:36 +01:00
Ricardo Salveti d25d62a0e9 gpio/nrf5: set and clear just the specific gpio pin
Don't use the previous reg value when setting up just one specific pin,
as it can have a side effect on other gpio pins.

Change-Id: I60e69950a72446a6fa7087b13dbcecf6ae4b15e4
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-06 15:50:10 +00:00
Anas Nashif f320338066 sensors: do not use choice for I2C address
Set the value for the I2C address directly and use only
one per sensor.

Change-Id: I24d06a964e8e372eddf262b70fe5d9854a04563c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-06 04:17:52 +00:00
Anas Nashif efd6b94929 sensors: HDC1000: check for manufacturer and device IDs
Make sure we are connected to the right device.

Change-Id: I09e696563191392d23a316ad065bb7e320df76bb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-06 04:17:44 +00:00
Ricardo Salveti bc1affbfa2 drivers/gpio: nrf5: Use generic GPIO base naming
NRF_GPIO_BASE can be used by both the nrf51 and nrf52 families, as it
gets defined by the nrf5x.h header files.

Change-Id: I8e6b265d9ce94551389ca170f105a53c88d58c68
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-06 04:09:29 +00:00
Anas Nashif 6a534710c0 sensors: use one init priority config for all sensors
Sensors are end-devices and usually nothing depends on them,
so set a global priority for all sensors and use it instead of
individual values per sensor.

Change-Id: I5847411e783ef8a8517f0ab1d8234810513707b4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-05 23:01:23 +00:00
Marcus Shawcroft 352ef5f033 eth: Rework LOG_ETHERNET_LEVEL config description.
Generalize the LOG_ETHERNET_LEVEL configuration parameter for use with
multiple ethernet drivers.

Change-Id: I26bc2189c8cf79db19f59e8082caec03b0d9c7b8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-05 11:29:37 +00:00
Javier B Perez d846dd1fcd drivers: shared irq: clean nested #if condition and align
Removed duplicated nest #if condition and aligned #if lines.

Change-Id: I54b8d9bfa166c41f133f8b1f5011c68ad68281a4
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-10-05 10:09:21 +00:00
Qiu Peiyang 76549c1b79 I2C: remove obsolete i2c_quark_se_ss driver
i2c_quark_se_ss driver is deprecated and replaced
by i2c_qmsi_ss. So remove i2c_quark_se_ss definition.

Change-Id: Idcc6a7f01ffae626ae7d5f9966eac67be78599af
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-10-05 10:07:30 +00:00
Iván Briano aba245daad drivers qmsi: Fix power management with reentrancy disabled
The new device control API added a 'device_power_state' variable to the
driver's data structure to keep track of the current power state set
for a device. This member variable is conditionally built into the
runtime data structure of each driver, but in some cases the whole data
structure is conditional on its respective API_REENTRANCY config
variable.

In those cases where the runtime data was previously used only for
reentrancy protection, the runtime data pointer used for device
initialization is NULL, and when power management is enabled, this
invalid pointer ends up dereferenced to get the device_power_state
member.

Make the declaration of the runtime data dependent on any of its
conditional members, and NULL only when all of those settings are
disabled.

Change-Id: I4f41e00ad8551a096db639e31d33f43752b6672f
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-10-05 09:51:09 +00:00
Anas Nashif b88f2e9e6a Merge "Merge bluetooth branch into master" 2016-10-05 09:26:37 +00:00
Peter Mitsis 96cb05ca50 unified: Add tickless idle support for x86 and ARM
Change-Id: I42d20355321f431900727768a0836ee18e96b667
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-04 20:02:50 +00:00
Johan Hedberg 41d60dc3ed Merge bluetooth branch into master
Main changes:

 - Initial A2DP support
 - Initial SDP support
 - Controller code cleanups
 - Improved RFCOMM support
 - Minor fixes & cleanups here and there

----------------------------------------------------------------
Arkadiusz Lichwa (9):
      Bluetooth: RFCOMM: Shuffle up Kconfig's RFCOMM_L2CAP_MTU
      Bluetooth: HFP HF: Fix getting inaccessible internal
      Bluetooth: HFP HF: Enforce Kconfig's HFP_HF relation to RFCOMM
      Bluetooth: init: Add HFP to automated tests
      Bluetooth: A2DP: Remove internal stack headers
      Bluetooth: AVDTP: Remove internal headers
      Bluetooth: AVDTP: Fix getting inaccessible internal
      Bluetooth: L2CAP: Fix sending double connection request
      Bluetooth: Refactor distribution of security procedure status

Arun Jagadish (2):
      Bluetooth: AVDTP: Module Initialization
      Bluetooth: AVDTP: Connect and Disconnect API

Carles Cufi (6):
      Bluetooth: Controller: Clean up naming in the HCI driver
      Bluetooth: Controller: Use net_buf for HCI RX
      Bluetooth: Controller: Use net_buf for CC/CS TX
      Bluetooth: Controller: Use net_buf for evt and ACL RX
      Bluetooth: Controller: Remove unused macro
      Bluetooth: Controller: Fix __packed placement

Itankar, Piyush T (2):
      Bluetooth: A2DP: Initialization of A2DP
      Bluetooth: A2DP: Added Connect API

Jaganath Kanakkassery (5):
      Bluetooth: RFCOMM: Handle dlc disconnection from peer
      Bluetooth: RFCOMM: Handle session disconnection from peer
      Bluetooth: RFCOMM: Introduce rfcomm_send_dm()
      Bluetooth: RFCOMM: Introduce dlc destroy
      Bluetooth: RFCOMM: Replace tabs with spaces

Johan Hedberg (6):
      Bluetooth: L2CAP: Extend bt_l2cap_create_pdu() with 'reserve' parameter
      Bluetooth: tests: Fix name of Quark SE C1000 SS devboard
      Bluetooth: RFCOMM: Remove reference counting
      Bluetooth: RFCOMM: Fix some remaining white-space issues
      Bluetooth: Adjust maximum connections & paired devices range
      Bluetooth: Fix compiler warnings/errors related to string casts

Kaustav Dey Biswas (1):
      Bluetooth: SDP: Server: Initialize and accept incoming connections

Luiz Augusto von Dentz (7):
      Bluetooth: eddystone: Add missing characteristics
      Bluetooth: init: Add CONFIG_BLUETOOTH_RFCOMM to prj_20.conf
      Bluetooth: init: Add CONFIG_BLUETOOTH_AVDTP to prj_20.conf
      Bluetooth: AVDTP: Add missing BLUETOOTH_DEBUG_AVDTP
      Bluetooth: init: Add CONFIG_BLUETOOTH_A2DP to prj_20.conf
      Bluetooth: GATT: Fix locking RX fiber
      Bluetooth: Enable CONFIG_BLUETOOTH_DEBUG_AVDTP with prj_20.conf

Mariusz Skamra (2):
      Bluetooth: tester: Fix advertising data
      Bluetooth: Enable privacy for nimble

Szymon Janc (5):
      Bluetooth: SMP: Remove unused static const
      Bluetooth: SMP: Fix unused static variable
      Bluetooth: Add debug keys support to HCI ECC emulation code
      Bluetooth: L2CAP: Cleanup flags names for BR/EDR channels
      Bluetooth: L2CAP: Rename br_channels to br_fixed_channels

Vinayak Chettimada (2):
      Bluetooth: Controller: Fix SCHED_ADVANCED cond, compilation
      Bluetooth: Controller: Remove custom irq implementation

 drivers/bluetooth/controller/Makefile             |   1 -
 drivers/bluetooth/controller/hal/ccm.h            |   4 +-
 drivers/bluetooth/controller/hal/clock.c          |  18 +-
 drivers/bluetooth/controller/hal/ecb.c            |  17 +-
 drivers/bluetooth/controller/hal/irq.c            |  53 --
 drivers/bluetooth/controller/hal/radio.c          |  14 +-
 drivers/bluetooth/controller/hal/rand.c           |   7 +-
 drivers/bluetooth/controller/hci/hci.c            | 903 ++++++++-----------
 drivers/bluetooth/controller/hci/hci_driver.c     | 290 +++---
 drivers/bluetooth/controller/hci/hci_internal.h   |   9 +-
 drivers/bluetooth/controller/ll/ctrl.c            |  32 +-
 drivers/bluetooth/controller/ll/ctrl.h            |   8 +-
 drivers/bluetooth/controller/ll/pdu.h             | 110 +--
 drivers/bluetooth/controller/util/work.c          |  69 +-
 drivers/bluetooth/controller/util/work.h          |   2 +-
 include/bluetooth/a2dp.h                          |  47 +
 include/bluetooth/bluetooth.h                     |   2 +-
 include/bluetooth/l2cap.h                         |  15 +-
 include/bluetooth/rfcomm.h                        |  29 +-
 .../hal/hal_irq.h => include/bluetooth/sdp.h      |  35 +-
 net/bluetooth/Kconfig                             |  58 +-
 net/bluetooth/Makefile                            |   6 +-
 net/bluetooth/a2dp.c                              | 126 +++
 net/bluetooth/a2dp_internal.h                     |  36 +
 net/bluetooth/att.c                               |  40 +-
 net/bluetooth/avdtp.c                             | 180 ++++
 net/bluetooth/avdtp_internal.h                    | 158 ++++
 net/bluetooth/conn.c                              |   2 +-
 net/bluetooth/hci_core.c                          |  25 +-
 net/bluetooth/hci_ecc.c                           |  71 +-
 net/bluetooth/hfp_hf.c                            |   2 +-
 net/bluetooth/l2cap.c                             |  28 +-
 net/bluetooth/l2cap_br.c                          | 115 +--
 net/bluetooth/l2cap_internal.h                    |  16 +-
 net/bluetooth/rfcomm.c                            | 173 +++-
 net/bluetooth/rfcomm_internal.h                   |  82 +-
 net/bluetooth/sdp.c                               | 294 ++++++
 net/bluetooth/sdp_internal.h                      |  56 ++
 net/bluetooth/smp.c                               |  21 +-
 net/bluetooth/smp_null.c                          |   2 +-
 samples/bluetooth/eddystone/src/main.c            |  79 ++
 tests/bluetooth/init/prj_20.conf                  |   6 +
 tests/bluetooth/init/testcase.ini                 |   2 +-
 tests/bluetooth/tester/prj_nimble.conf            |   1 +
 tests/bluetooth/tester/src/gap.c                  |   2 +-
 45 files changed, 2116 insertions(+), 1130 deletions(-)
 delete mode 100644 drivers/bluetooth/controller/hal/irq.c
 create mode 100644 include/bluetooth/a2dp.h
 rename drivers/bluetooth/controller/hal/hal_irq.h => include/bluetooth/sdp.h (59%)
 create mode 100644 net/bluetooth/a2dp.c
 create mode 100644 net/bluetooth/a2dp_internal.h
 create mode 100644 net/bluetooth/avdtp.c
 create mode 100644 net/bluetooth/avdtp_internal.h
 create mode 100644 net/bluetooth/sdp.c
 create mode 100644 net/bluetooth/sdp_internal.h

Change-Id: I22864805bbb931fe9150ccd84d389b3e30794f7e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-04 18:48:00 +03:00
Baohong Liu e965119cd9 dma: qmsi_shim: add typecasting to avoid compilation error
Add typecasting in dma QMSI shim to avoid compilation error.

The DMA API and QMSI have their own definitions for the
dma configuration parameters, such as handshake_interface,
handshake_polarity, source/destination_transfer_width,
channel_direction, and source/destination_burst_length.
When a API is called, the shim driver will assign values
for the above-mentioned parameters to the configuration
variable(based on QMSI's definiton) from the values in the
variable provided by the caller based on API's definition.
Even though all these parameters have similiar definition
and values in both the generic API and QMSI, QMSI uses
its own names which are different from those definied in
the generic API. Without typecasting, the parameter value
assignment will cause compilation error(even though error
only happens for some compiler).

Jira: ZEP-1031

Change-Id: I147c690799514bd611cd9f88316f44346e095359
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-10-04 12:28:38 +00:00
Vinayak Chettimada 8e25789052 Bluetooth: Controller: Remove custom irq implementation
As part of an effort to closely integrate with Zephyr OS,
removed the custom implementation of IRQ interfaces used
in controller code.

Jira: ZEP-841

Change-id: Ie427f45aeecad51053112371526cb7dc4817248f
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Vinayak Chettimada 54164b1350 Bluetooth: Controller: Fix SCHED_ADVANCED cond, compilation
Code under SCHED_ADVANCED macro in ctrl.c is used to
disable advanced radio time space scheduling calculations
used for placing non-overlapping observer and master roles;
to populate connection parameter request/response PDU
fields, and autonomous generation of slave initiated
connection parameter requests.

This macro shall always be enabled for optimal and correct
operation of the controller, It shall only be disabled to
debug failures in other part of the controller, to rule out
this code's influence, if any, on the failure being
debugged.

Change-id: I04e5f837ef0a5658361bd3668f583f1e13504570
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Carles Cufi 2fb8a11906 Bluetooth: Controller: Fix __packed placement
Place __packed at the end of the structure definition in line
with the rest of the Zephyr codebase.

Jira: ZEP-732

Change-Id: I25aa731cbd188a6e23ca2035eb22fa919295bb25
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Carles Cufi e9d32ed6e1 Bluetooth: Controller: Remove unused macro
Leftover from previous commits, this macro is not used anymore in
the HCI implementation.

Change-Id: I376c92a6b68432d2ff818ea25e68f087131e8479
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Carles Cufi 2f33724017 Bluetooth: Controller: Use net_buf for evt and ACL RX
Use the net_buf structure directly when populating incoming
ACL data or asynchronous events. This ensures that no additional
memcpy() operations are required and removes completely the
statically allocated buffers in hci.c.

Jira: ZEP-726

Change-Id: I6ac8bd0becb7037ce8ecfac109f44832d23fcfd2
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Carles Cufi 0a720c4771 Bluetooth: Controller: Use net_buf for CC/CS TX
Preallocate a response event net_buf buffer before processing an
incoming command and provide it to hci.c so that it populates
the event directly, instead of using a temporary buffer than
must then be copied into the return net_buf.
This applies exclusively to Command Complete and Command
Status, since those are the only events that are sent in
direct respone to an incoming command.

Jira: ZEP-726

Change-Id: Ia3ea71ac497690af929c44308760f68491ea829e
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Carles Cufi d12b6c87c9 Bluetooth: Controller: Use net_buf for HCI RX
Instead of copying the net_buf contents into a temporary
buffer byte-by-byte, the Controller HCI code now handles
incoming commands and ACL packets from the Host directly
in the net_buf containers, to avoid unnecessary memory
copying and to align with the rest of the Bluetooth stack.

Jira: ZEP-726

Change-Id: I9802607d84ee6206218b711e7e6e23dafb70581a
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Carles Cufi f976decdfa Bluetooth: Controller: Clean up naming in the HCI driver
As part of the effort to consolidate the BLE Controller's
HCI layer, the functions in hci_driver.c now use the "hci_driver_"
prefix when it is sensible to do so, and prefixes have been
removed altogether when they are not required.

Jira: ZEP-726

Change-Id: Icd3e56e0170f15636245ea12a389a5a9e86c166c
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Maureen Helm 51c146b95b frdm_k64f: Add support for RGB LEDs
Add PTB22, PTE26, and PTB21 to the frdm_k64f pinmux table, and helper
macros to board.h to map them to red, green, and blue LEDs respectively.

Change-Id: I257621467e71dfd9bdc5d97d6da444dfb5c58b2b
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-04 01:29:14 +00:00
Maureen Helm a6b57c9455 frdm_k64f: Add support for push button switches
Add PTC6 and PTA4 to the frdm_k64f pinmux table, and helper macros in
board.h to map them to SW2 and SW3 respectively.

Change-Id: Ia30df9015d6d3c09131b4fbb2f2009ee745f7268
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-04 01:23:00 +00:00
Marcus Shawcroft 9d67337c2d k64f: Refactor pinmux configuration table.
Statically compute the number of elements in the pinmux table rather
than keep a manual entry in step with the table.

Change-Id: I99634aa460a39bb8a9a10fe37d28aaae792aa641
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-03 19:49:40 +00:00
Ramesh Thomas 0d2b8224b1 timer: Fixes a build error when MVIC is used
MVIC does not have _REG_TIMER_CFG defined because it does
not have a timer config register. Add checks for MVIC at
places where it is used.

Jira: ZEP-1015
Change-Id: I59f5c43cc2d1b17cf9e88b940631c2542e9729ab
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-10-03 17:28:02 +00:00
Anas Nashif 0cf87e4c26 pinmux: remove nonexistant galileo Kconfig
Change-Id: I9f2fb8024f3de6fa6aaf1220ecfa884fabb6ad74
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-03 02:29:23 +00:00
Andrew Boie edeb1f1c52 x86: interrupts: optimize and simplify IRQ stubs
Interrupt stubs now just push the ISR and parameter onto the stack
and jump to the common interrupt code, never to return.

Change-Id: I82543d8148b5c7dfe116c43f41791f852614bb28
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-28 20:28:06 +00:00
Anas Nashif f720bb12a7 mvic: fixed printk format
Jira: ZEP-970
Change-Id: Ie57938d3d1c4740a7a4aa0ed403d2b2cc0e36eae
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-24 08:12:47 -04:00
Andrew Boie 7c385bd8b1 ioapic: make init-time RTE masking optional
In some cases we can either assume they are already masked
at boot and save some cycles, or the IOAPIC has configuration
from a prior boot stage that needs to be preserved.

Change-Id: I0c71ff0f01a6ee13a3b9c9e239d5a933d6cb6542
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-23 17:54:19 +00:00
Andrew Boie d3831180cf apic: set initial PM state at build time
Change-Id: I7531088d0455fb405513787eb61137ff79ca8b29
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-23 17:53:49 +00:00
Andrew Boie 325cae5c94 kernel: remove lingering irq_connect_dynamic() references
This API no longer exists.

Change-Id: I724bee8c0ebfbbe2d47c00c7645977d817bbcd36
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-23 15:36:51 +00:00
Kumar Gala 9ec847e608 Revert "rfc: ksdk: Add KSDK ENET driver."
This reverts commit 581e15ced2.

The commit was marked RFC and should not have been merged yet.

Change-Id: Iafd3587f8840e64670c32fa5726ea20ac9c9962a
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-09-23 09:07:26 -05:00
Marcus Shawcroft 581e15ced2 rfc: ksdk: Add KSDK ENET driver.
Provide a network driver wrapped around the KSDK ENET and PHY
drivers.

This driver is functional, just.  It is not in a fit state to be merged to master yet.

Origin: Original

Change-Id: Id29e756f33c6c0263926139188c49f9a9c3d5e09
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-09-23 01:54:00 +00:00
Javier B Perez 14dd53289d drivers: serial: uart_qmsi: update Quark SE C1000 config
Updated CONFIG_SOC_QUARK_SE_SS to CONFIG_SOC_QUARK_SE_C1000_SS

Change-Id: I7dc02d91a4d739f6cd3f84001d1dd29759317163
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-09-22 18:00:07 +00:00
Anas Nashif 58002193e9 drivers: gpio: reuse gpio Kconfigs for sensor subsystem
No need to create new Kconfig that do exactly the same, just
reuse those from the main QMSI driver.

Change-Id: I965055f36845ac0464e4a383b0d05c3ae35c0015
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 01:00:46 +00:00
amirkapl c490219d1e power_mgmt: Update sample and drivers according to new pm device API
Update the power sample and drivers with the new device driver power
management API using the existing logic

Jira: ZEP-954
Change-Id: Idd94232e458767635973e94e9fc673c01612c1e2
Signed-off-by: Amir Kaplan <amir.kaplan@intel.com>
2016-09-22 00:23:43 +00:00
Javier B Perez 035ec8249d drivers: timer: cortex_m_systick remove dead code
Removed CONFIG_INT_LATENCY_BENCHMARK dead code.
CONFIG_INT_LATENCY_BENCHMARK depends on ARCH="x86", it will never
be true for ARM code.

Change-Id: Ia5779a69b1bf670ebb140c2923c9fe0af6b781d4
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-09-21 23:11:41 +00:00
Javier B Perez d4429bfb88 drivers: timer: loapic remove unused workaround
Removed unused workaround in loapic. There are no references
of usage.

Change-Id: I8700b4b7ce8efef5e7b95e6cdd2b201eae3f1f37
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-09-21 14:51:34 +00:00
Jesus Sanchez-Palencia 8108aa8990 usb_dw: Clear device address on USB Reset
During USB device reset, the controller must have its device address
cleared (set to 0). This is not really taken into account by most host
side stacks, which is the reason why this bug didn't show up before.
It was found when we were trying to run the USB20CV [1] compliance test
suite on Windows.

Without this fix the device doesn't show up on the targets list, which
means device enumeration failed. With this patch in place the bug is
fixed and the device gets listed.

Tested with the CDC ACM sample application.

Jira: ZEP-950

[1] http://www.usb.org/developers/tools/usb20_tools/

Change-Id: I0b78f7ce043fa29dde0fb7f3b3aecee9844f4d11
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-09-21 12:19:05 +00:00
Juan Manuel Cruz b97f3f3996 eth: Add full-duplex configuration to ENC28J60
The driver originally gets the full-duplex configuration
from the PHCON1 register and PDPXMD bit as stated by the
ENC298J60 specification document section 2.6 "LED Configuration".
This section trust the board to LEDB connection to signal the
full-duplex configuration.

This commit gets the full-duplex configuration from Kconfig
symbols to allow a proper functionality even when the board
is not connecting LEDB apropriately.

Change-Id: I803958409a611e23e2c3e03f40b412f1695947af
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-09-17 22:43:52 +00:00
Juan Manuel Cruz bb4c1bd82a eth: Initial release to tx semaphore for the ENC28J60 driver.
There is a tx semaphore that controls a single access to the
transmission service. The device is capable to manage a single
transmission call at a time. Multiple requests need to wait
for the resource to be free.

This commit adds the initial release to the tx semaphore.

Jira: ZEP-895

Change-Id: Ic9879cfd15bb1494644b2cf0f4565f7e6a2c1c22
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-09-17 22:43:51 +00:00
Juan Manuel Cruz 8da0bad30a eth: Adjust ENC28J60 MAC configuration.
ENCC28J60 specs section 6.5 "MAC Initialization settings"
state that MACON3(7:5) register configure automatic padding and CRC.
It also states that the configuration 111 and 011 both configure as
all short frames to be zero padded with a valid CRC appended.

Nevertheless, experimentally, there are ocassions when configuring as 111
frames does not have a CRC appended. This frames could be rejected
by the receiver if it is configured to do so.

This commit changes configuration from 111 to 011, which is not
presenting that behavior.

Jira: ZEP-842

Change-Id: I302bb99f7a1f23b298fe0db0245963b640644040
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-09-17 22:43:51 +00:00
Johan Hedberg 5cc5141371 Merge bluetooth branch into master
Main changes:

 - Cleanups & refactoring to the native controller code
 - Support for cross-transport pairing from BR/EDR to LE
 - Fix potential deadlock in TX fiber when disconnecting
 - Initial skeleton for the Hands-Free Profile (HFP)
 - Fix to Resolvable Private Address (RPA) updates
 - Added flow control support to RFCOMM

----------------------------------------------------------------
Carles Cufi (21):
      Bluetooth: HCI: Fix the length of supported commands
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: HCI: Add handle to LTK command complete events
      Bluetooth: HCI: Add handle to conn param update command complete
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Unify handling of async events
      Bluetooth: HCI: Fix and extend advertising report events
      Bluetooth: HCI: Add auth payload expiry event
      Bluetooth: Controller: Use hci.h for control event handling
      Bluetooth: HCI: Add read remote version info event
      Bluetooth: Controller: Use hci.h for data-control evt handling
      Bluetooth: Controller: Use hci.h for num complete
      Bluetooth: Controller: Remove HCI event definitions from hci.c
      Bluetooth: Controller: Use hci.h for ACL data
      Bluetooth: Controller: Clean up HCI macros
      Bluetooth: Controller: Implement LE_RAND command
      Bluetooth: Controller: Make HCI endianness-independent
      Bluetooth: Controller: Refactor HCI files

Grzegorz Kolodziejczyk (3):
      Bluetooth: tester: Add support for L2CAP connect command
      Bluetooth: tester: Add support for L2CAP disconnect commands
      Bluetooth: tester: Add support for L2CAP listen command

Itankar, Piyush T (1):
      Bluetooth: Init: Updated filiter options for test_20

Jaganath Kanakkassery (1):
      Bluetooth: RFCOMM: Implement RX flow control

Johan Hedberg (2):
      Bluetooth: GATT: Fix potential bt_conn reference leak
      Bluetooth: Fix giving back pkts semaphore when disconnecting

Luiz Augusto von Dentz (3):
      Bluetooth: ATT: Fix not handling error response properly
      Bluetooth: HCI: Fix updating RPA too early
      Bluetooth: eddystone: Fix byteorder of advertisement

Mariusz Skamra (1):
      Bluetooth: tester: Add support for L2CAP send data command

Sathish Narasimman (1):
      Bluetooth: HFP HF: Initialize Handsfree profile

Sukumar Ghorai (1):
      Bluetooth: Pre-allocated RFCOMM Channels

Szymon Janc (16):
      Bluetooth: SMP: Move smp_create_pdu function up in a file
      Bluetooth: SMP: Add initial code for BR/EDR support
      Bluetooth: SMP: Clear keys on timeout when running over BR/EDR
      Bluetooth: SMP: Support Pairing Request over BR/EDR
      Bluetooth: SMP: Support Pairing Failed over BR/EDR
      Bluetooth: SMP: Distribute local keys over BR/EDR
      Bluetooth: Add support for reading encryption key size for BR/EDR
      Bluetooth: SMP: Fix encryption key size check in BR/EDR pairing req
      Bluetooth: SMP: Support Pairing Response over BR/EDR
      Bluetooth: SMP: Allow to force BR/EDR without SC support
      Bluetooth: SMP: Add support for LTK derivation from LinkKey
      Bluetooth: SMP: Add support for sending Pairing Request over BR/EDR
      Bluetooth: SMP: Add support for Identity Information over BR/EDR
      Bluetooth: SMP: Add support for Signing Information over BR/EDR
      Bluetooth: SMP: Add helper for reporting BR/EDR pairing complete
      Bluetooth: SMP: Factor out BR/EDR encryption check to helper

Vinayak Chettimada (4):
      Bluetooth: ATT: Remove unnecessary call to BT_ASSERT
      Bluetooth: log: Call _SysFatalErrorHandler in BT_ASSERT()
      Bluetooth: log: Include nanokernel.h to use BT_ASSERT()
      Bluetooth: Controller: Use BT_ASSERT instead of custom impl.

 drivers/bluetooth/controller/Makefile             |    2 +-
 drivers/bluetooth/controller/hal/clock.c          |    8 +-
 drivers/bluetooth/controller/hal/debug.h          |   27 +-
 drivers/bluetooth/controller/hal/ecb.c            |    2 +-
 drivers/bluetooth/controller/hal/radio.c          |    2 +-
 drivers/bluetooth/controller/hal/rand.c           |    2 +-
 drivers/bluetooth/controller/hal/rtc.c            |    2 +-
 drivers/bluetooth/controller/hci/hci.c            | 2380 +++++++-----------
 .../controller/{main.c => hci/hci_driver.c}       |   23 +-
 .../controller/hci/{hci.h => hci_internal.h}      |   14 +-
 drivers/bluetooth/controller/ll/ctrl.c            |  332 +--
 drivers/bluetooth/controller/ll/ticker.c          |    3 +-
 include/bluetooth/hci.h                           |   56 +-
 include/bluetooth/hfp_hf.h                        |   61 +
 include/bluetooth/log.h                           |   17 +-
 include/bluetooth/rfcomm.h                        |    8 +
 net/bluetooth/Kconfig                             |   23 +
 net/bluetooth/Makefile                            |    2 +
 net/bluetooth/att.c                               |    4 +-
 net/bluetooth/conn.c                              |   45 +-
 net/bluetooth/gatt.c                              |    7 +-
 net/bluetooth/hci_core.c                          |   18 +-
 net/bluetooth/hci_core.h                          |    4 +-
 net/bluetooth/hfp_hf.c                            |  123 +
 net/bluetooth/hfp_internal.h                      |   43 +
 net/bluetooth/l2cap_br.c                          |   15 +
 net/bluetooth/l2cap_internal.h                    |    1 +
 net/bluetooth/rfcomm.c                            |   49 +-
 net/bluetooth/smp.c                               |  953 ++++++-
 samples/bluetooth/eddystone/src/main.c            |    4 +-
 tests/bluetooth/init/testcase.ini                 |    7 +-
 tests/bluetooth/tester/src/bttester.h             |   71 +
 tests/bluetooth/tester/src/l2cap.c                |  306 +++
 33 files changed, 2785 insertions(+), 1829 deletions(-)
 rename drivers/bluetooth/controller/{main.c => hci/hci_driver.c} (94%)
 rename drivers/bluetooth/controller/hci/{hci.h => hci_internal.h} (68%)
 create mode 100644 include/bluetooth/hfp_hf.h
 create mode 100644 net/bluetooth/hfp_hf.c
 create mode 100644 net/bluetooth/hfp_internal.h

Change-Id: I7bc41fb1c53c0f5128a1e4ab38815d19018b603f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-16 13:28:24 +03:00
Carles Cufi 496b02b54a Bluetooth: Controller: Refactor HCI files
As part of the effort to consolidate the BLE Controller's
HCI layer, the following files have been renamed:

* hci.h -> hci_internal.h: contains the HCI API to be used
by the driver
* main.c -> hci_driver.c: Implement bt_driver and includes
initialization and glue code

Jira: ZEP-726

Change-Id: Ica8b3e114da42a766a1b14ce59558cacd899a1a7
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-16 04:40:34 +00:00
Anas Nashif 5363d14a9e boards: rename Quark SE Devboard to Quark SE C1000
This board now has an official name and will be available soon:

http://www.intel.com/content/www/us/en/embedded/products/quark/mcu/se-soc/overview.html

Jira: ZEP-758
Change-Id: Ia16d33722308cf81471321c3063bdc75055a4d50
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-16 03:10:31 +00:00
Anas Nashif 5e4b62c35c boards: rename Quark SE Devboard to Quark SE C1000 (Sensor Subsystem)
Jira: ZEP-758
Change-Id: I8ee5a2f9e4a6ecbd15214e59321bf27a502ef6ee
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-16 03:10:30 +00:00
Carles Cufi 4c9f1017c8 Bluetooth: Controller: Make HCI endianness-independent
Use the sys_ macros from byteorder.h to access all HCI
structure members that are endianness-dependent.

Jira: ZEP-726

Change-Id: I950f8eaca7048bf7972c2c4c347cfd5bbba17eb6
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 17:28:43 +02:00
Tomasz Bursztyka 86d02e01b1 gpio: stm32: Fix bug introduced by removing API 1.0 support
Bug was introduced by a6cf6038e3

Change-Id: I91ceab2ca20c4d2f70a953b56d895152a471125a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-09-14 16:16:07 +02:00
Marcus Shawcroft 1bea527da6 ksdk: Add KSDK RNGA driver.
Provide a random driver wrapped around the KSDK RNGA driver.

Origin: Original

Change-Id: I43feeb37d8d5173c7b95af8e80434fb7dc77a83e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-09-14 12:35:30 +00:00
Tomasz Bursztyka a6cf6038e3 gpio: Remove obsolete API 1.0 callback mechanism
In 1.0 you could set only one callback on the whole gpio controller. It
was impossible for another sub-system to add another callback, without
overwritting an existing one.

Such API has been obsolete for a long time and no one is using it
anymore. Thus removing it entirely.

Change-Id: I6a17fd99373dc6cef1fa2ebb421e992412d5015e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-09-14 10:51:09 +00:00
Carles Cufi 90871a5e98 Bluetooth: Controller: Implement LE_RAND command
The LE_RAND HCI command was not filling in the rand array
with 8 random numbers as required by the spec.
Please note that the while() loop inside the command's
implementation can take up to hundreds of ms to execute.

Jira: ZEP-726

Change-Id: If27ff861ee5fa7842cd469e99d5bfa8ac47ac2fa
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi ef10baa235 Bluetooth: Controller: Clean up HCI macros
Clean up, document and remove the macros used in hci.c
to access the different parameters and calculate lengths
of events and data structures.

Jira: ZEP-726

Change-Id: I476aa9e061dfe429b5181265167bffa203ed151b
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi ec44eae44d Bluetooth: Controller: Use hci.h for ACL data
Switch to using the definitions in include/bluetooth/hci.h
for ACL data handling, both in RX and TX.

Jira: ZEP-726

Change-Id: I6b5f6de4ff568c4e73432df3edfa7d0a57f22fff
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi 92b4458690 Bluetooth: Controller: Remove HCI event definitions from hci.c
Delete all event definitions from hci.c since the code now
uses the ones in include/bluetooth/hci.h exclusively.
This is the fourth and last commit in a series that transitions
from the event structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I625c2aecf759823a1cc73a3ea096564284fe8c52
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi 0ed85e24be Bluetooth: Controller: Use hci.h for num complete
Use Zephyr's include/bluetooth/hci.h for the HCI event
Number of Completed Packets.
This is the third commit in a series that transitions from
the event structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I179bceb2f9dc07d7a1a524c3a80f0886f712ec2b
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi a587f2692c Bluetooth: Controller: Use hci.h for data-control evt handling
Use Zephyr's include/bluetooth/hci.h for HCI event
handling in data-related events.
This is the second commit in a series that transitions from
the event structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I0e9e6f709091859af47d90b26f5e7baa830a2838
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi a955f583eb Bluetooth: Controller: Use hci.h for control event handling
Use Zephyr's include/bluetooth/hci.h for HCI event
handling in control events.
This is the first commit in a series that transitions from
the event structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I6f131675add18e2ae061f0fb2cf220ea7057f852
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi 0c463077ad Bluetooth: Controller: Unify handling of async events
This changes the way that aysnchronous events are handled
in the BLE controller's HCI layer. It performs all common
operations in a single place to avoid code repetition of the
same memory accesses over and over.

Jira: ZEP-726

Change-Id: Id9e8395944e8800f32dd9749da2b4f5c901c8682
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi 9d48ef5888 Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
Continue using Zephyr's include/bluetooth/hci.h for HCI command
handling in more of the commands.
This commit deletes all command and command complete and
command status event definitions and structures present in
hci.c.
This is the sixth commit in a series that transitions from
the structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I34635a1f55f3aef124fd5ff005c99cedb40b8a49
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi be2bbbae2d Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
Continue using Zephyr's include/bluetooth/hci.h for HCI command
handling in more of the commands.
This commit cleans up hci_cmd_handle() to use the new macros
added in previous commits.
This is the fifth commit in a series that transitions from
the structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I152e02ed15042d367e95432bdd07ae5c74935be8
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi 69e1816868 Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
Continue using Zephyr's include/bluetooth/hci.h for HCI command
handling in more of the commands.
This commit removes Nordic Semiconductor Vendor-Specific
commands, since they are currently unused and
manufacturer-specific.
This is the fourth commit in a series that transitions from
the structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: If0141072489777bfecc06e4aaa5f569898a5c449
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi 21b3fa240d Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
Continue using Zephyr's include/bluetooth/hci.h for HCI command
handling in more of the commands.
This commit ports the LE controller commands to hci.h.
This is the third commit in a series that transitions from
the structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I3f11cca1da4aa6a20cce9706362818f8f6c87b0a
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Vinayak Chettimada e00eed79aa Bluetooth: Controller: Use BT_ASSERT instead of custom impl.
As part of closer integration into Zephyr, remove the use
of custom assert mechanism and use BT_ASSERT instead.

Jira: ZEP-761

Change-id: I27f37d697b0a84bc001754a8d0b4dbb6ddb54298
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Carles Cufi 34cd316301 Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
Continue using Zephyr's include/bluetooth/hci.h for HCI command
handling in more of the commands, including the informational ones.
This is the second commit in a series that transitions from
the structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: Iecbc7ae5ba2c8435a51d62d59e8095aa25e6dc0e
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-14 08:45:45 +03:00
Benjamin Walsh 3caec4e95d unified/drivers: adapt timer drivers to unified kernel
They must provide the k_cycles_get_32() API and must not refer to
command packets: the latter do not exist on unified kernels.

Change-Id: Ia354dc060e5ad2595850f97da82d8feb590d16b7
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Andrew Boie eeacd2061d mvic: default to IRQ 10 instead of 0 for timer
This is a better choice of default; on Mint Valley using IRQ 0
for the timer collides with the DMA Error IRQ line.

Issue: ZEP-849
Change-Id: I14cb60fbe548488198813b2351e0ed1f07c2d07d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-12 17:53:21 +00:00
Javier B Perez 453d172bff sensor: HP206C: fix kconfig sys log help
Changed help message to be in compliance with the rest of sensors.

Change-Id: Ia18f7623eda5f86fe6f7d99ac934f1a9beda55a8
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-09-12 10:35:41 -05:00
Laurentiu Palcu 3ef2e059c3 sensor: add driver for HP206C sensor
This sensor is a high precision barometer, altimeter and temperature
sensor. It can also be found on the Grove Barometer module (v1.0).

Sensor datasheet:
http://www.hoperf.com/upload/sensor/HP206C_DataSheet_EN_V2.0.pdf

Grove link:
http://www.seeedstudio.com/depot/Grove-Barometer-HighAccuracy-p-1865.html

Origin: Original
Change-Id: I99986b26b6b4447e31e12a1fc17ede3e6bb4c586
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-09-12 12:18:55 +00:00
Dragan Cvetic eb147c650c spi_qmsi: Add suspend/resume
This patch implements suspend/resume routines which
preserve SPI master 0 and 1 context in SYS_PM_DEEP_SLEEP.
The following parameters are suspended/resumed:
- All non-sticky RW registers for the SPI device which
  are not related to a transfer.
- The SPI MASK registers (interrupt routing register).

The suspend/resume functionality is implemented in
the QMSI shim layer as a fast and temporary solution,
it will be removed and migrated to QMSI later.

Change-Id: Ib60317ca41013a3e794820e9c3ef34f35d108209
Signed-off-by: Dragan Cvetic <dragan.cvetic@intel.com>
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-09-12 12:17:16 +00:00
Qiu Peiyang cf0efbb51f drivers/pinmux: delete deprecated PINMUX_DEV_QUARK_MCU
CONFIG_PINMUX_DEV_QUARK_MCU is deprecated and QUARK MCU support
is replaced by CONFIG_PINMUX_DEV_QMSI. So delete this deprecated
CONFIG option.

Change-Id: I2cad6cfd4344386a00d45a579e8cc586935b041f
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-09-12 02:08:08 +00:00
Qiu Peiyang 79e3b5a405 drivers/pinmux: fix CONFIG_PINMUX_DEV_NAME dependency issue
CONFIG_PINMUX_DEV_NAME should depends on CONFIG_PINMUX_DEV, not
CONFIG_PINMUX. In current situation, user will be able to access
pinmux dev driver without enabling CONFIG_PINMUX_DEV. This isn't
excepted to happen.

Change-Id: I75bcfff5a51e1dc93e002c0c6a65876f93cde5b8
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-09-12 02:08:07 +00:00
Julien Delayen fa1d6fb1c9 aonpt_qmsi: Implement suspend and resume functions
In order to restore aonpt context after entering
SYS_PM_DEEP_SLEEP, suspend and resume functions
are called.

Only the interrupt mask is restored as it is reset by
the QMSI ROM and other registers are sticky.

The suspend/resume functionality is implemented in
the QMSI shim layer as a fast and temporary solution,
it will be removed and migrated to QMSI later.

Change-Id: I0dcd4552cd8c60ecb4eb650fc3ad85566b726a38
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-09-12 00:31:54 +00:00
Julien Delayen 859a367d9c i2c_qmsi: Implement suspend and resume functions
In order to restore i2c context after entering
SYS_PM_DEEP_SLEEP, suspend and resume functions
are called.

The following parameters are restored:
 - All registers for the I2C device.
 - I2C clocks.

I2C depends on the DMA which is enabled separately.

The suspend/resume functionality is implemented in
the QMSI shim layer as a fast and temporary solution,
it will be removed and migrated to QMSI later.

Change-Id: I22ca2fb9884109f7b5ca75af572811187a531403
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-09-12 00:30:28 +00:00
Julien Delayen 0392d79845 wdt_qmsi: Implement suspend and resume functions
In order to restore watchdog context after entering
SYS_PM_DEEP_SLEEP, suspend and resume functions
are called.

The following parameters are restored:
 - All registers for the WDT device.
 - Watchdog interrupt mask.

The suspend/resume functionality is implemented in
the QMSI shim layer as a fast and temporary solution,
it will be removed and migrated to QMSI later.

Change-Id: I6e4e30a797b0ca38ce727d50fa51d1b2f8330405
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-09-12 00:29:25 +00:00
Ramesh Thomas fa175975e9 power_mgmt: Make device_pm_ops definition static
DEFINE_DEVICE_PM macro was not defining device_pm_ops
as 'static'. Fixes the issue and impacted areas.

Jira: ZEP-639
Change-Id: I5e1de6af97bf7b2b690af0c81034ce167e655e43
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-09-12 00:28:05 +00:00
Baohong Liu b0c28f2d00 drivers: i2c: fix a compilation dependency issue
Fix a compilation warning. Compilation of the i2c driver
requires QMSI dma object file. As a solution, the current
code has "selects DMA_QMSI" in i2c Kconfig. This results
in a compilation warning since "select DMA" is also
required. Adding "select DMA" and "select DMA_QMSI"
together in i2c Kconfig can solve the compilation issue.
But, this will cause the dma driver be unnecessarily
enabled. So, the solution is to fix the issue in the QMSI
part instead of in the shim driver.

Jira: ZEP-777 ZEP-778

Change-Id: Id4c1f749bf71eece1e70583bd586a69b596768b2
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-09-10 11:29:49 +00:00
Andy Ross cc5c3c48b6 uart_qmsi: Get the interrupt handling right on ARC
The Sensor Subsystem has different IRQ numbers for the same device
across CPUs.  QMSI declares these, but doesn't do anything to try to
map it automatically, so we have to do it in the driver.

Similarly the SCSS interrupt routing (the SoC-wide "APIC", which is
distinct from the per-CPU interrupt masking hardware) needs to know
which CPU we're trying to unmask an interrupt for.

Change-Id: I27e5ec44f324f869e16a92e7ef40a22a305d98a2
Jira: ZEP-546
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-09 21:37:56 +00:00
Andy Ross 425145da08 uart_console: Fix line endings
Overwhelming industry practice when using two-byte line termination is
to end the line with "\r\n" and not "\n\r".

Also remove needless casts.  GCC does not warn on int-to-char
conversions.

Change-Id: If01a2e5ca327aacebcbcaf384af9c7131119689b
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-09 21:37:55 +00:00
Andrew Boie eec13ca8c1 interrupt_controller: allow for indeterminate faulting vectors
You can't query the LOAPIC for every kind of interrupt that fires,
it has no idea about IRQs that were generated by an 'int' instruction
for example. Extend the semantics of _irq_controller_isr_vector_get()
to return -1 if the vector can't be identified.

Issue: ZEP-602
Change-Id: I1174aa62fbedffdcd329d60da8ef14fabb042dc3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-08 12:47:14 -07:00
Baohong Liu 20d85fefe9 i2c: qmsi_shim: change some i2c config parameters to SoC specific
Change the signal ramp up/down config parameters in i2c driver
module to SoC specific.

Jira: ZEP-753

Change-Id: Ie01f1d890a7133d30ea53eee07f60354734a8571
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-09-08 11:57:41 +00:00
Anas Nashif ce52e3988f Merge "Merge bluetooth branch to master" 2016-09-08 02:26:59 +00:00
Maureen Helm e4067638b7 i2c: ksdk: Add shim driver
Add a shim layer around the ksdk I2C driver to adapt it to the Zephyr
I2C interface. Currently only supports master mode.

Jira: ZEP-717
Change-Id: I704b8c38e22e456bb9fa4325682b2a354a27a7ba
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-09-07 14:40:20 +00:00
Vinayak Chettimada 2253f9b2b0 Bluetooth: Controller: alternate ticker compare set logic
Paranoid with older compare set logic, the changes in this
commit is better in avoiding compares being set to stale
count values (values in past). Compares shall always be set
in future w.r.t to current count value in the counter h/w.

No longer using fp_worker_sched() to explicitly run the
worker because there may be no ticks elapsed when worker
runs, which leads to ticker job running thereafter not to
update the compare to a new value, probably leading to a
stalled controller roles.

Change-id: If07f648357585ebb80c35d1320210eac3137781c
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 13:19:37 +00:00
Carles Cufi 42f7ab9443 Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
Start using Zephyr's include/bluetooth/hci.h for HCI command
handling.
This is the first commit in a series that transitions from
the structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I1d79586b85d25c8ef707b8a2b19a27a77b08b819
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi cdb197c727 Bluetooth: Controller: Unify handling of CC and CS
Place common code in hci_evt_handle() so as to avoid code
duplication in the handling of command complete and
command status events.

Jira: ZEP-726

Change-Id: I35ffcb63518b52a2b209f83ef6b8bbb1d1b4a849
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi 4ecc06c1e2 Bluetooth: Controller: Unify handling of unknown command
Handle all instances of an unknown OCF in a common place
instead of it being spread in multiple functions.

Jira: ZEP-726

Change-Id: Ibd9ebe429754980b243cb8772702cfeb59b0a18b
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 863e2b5ff5 Bluetooth: Controller: Enable all supported LE states
Controller implementation supports all Bluetooth Spec. v4.2 LE
states. Include the LE Read Supported States Command in Read
Local Supported Commands HCI command complete returned by the
Controller.

Change-id: I399f7c0326b058577e97e6d8a2676afbeb73b6fe
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 7a0561a60f Bluetooth: Controller: Measure and use correct stack size
Use stack_analyse in the recv fiber to print actual stack
usage, use this as default in Kconfig option, and declare a
rx fiber stack of Kconfig supplied stack size.

Change-id: Id97ad2de4f7be3069f93271d60544f760abbf575
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi 2334e225b7 Bluetooth: Controller: Use offsetof() in memory sizing
GCC requires __builtin_offsetof() to be used whenever
sizing arrays with its help. Now that stddef.h
includes conditional compilation, use the macro instead
of hardcoding the GCC usage.

Jira: ZEP-732

Change-Id: Ieb5c694e1dc8323bd1fa2d18711a893f8824c5b1
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko 68182568cb drivers/nble: Rename nrf51 power management functions
Rename nrf51_enable() to nrf51_wakeup()
and nrf51_disable() to nrf51_allow_sleep().

Change-Id: Ie8e8fa2dde281f212e231e0c4b751d3e0021b6b6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 09b5998ced Bluetooth: Controller: Fix deadlock in recv fiber
Controller's fiber is expected to read all enqueued events
and data, hence wait on semaphore only after all events and
data are read.

Change-id: I0150f042b0ba91efa712b38903752b20198e5e6e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 5860686013 Bluetooth: Controller: Fix memory required calculation macro
Change-id: I73b06983911590f63728d769c401c8a9a53053d7
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko 7a65695f0a Bluetooth/drivers: Fix missing argument in printf for h5 driver
Change-Id: Ia051f96742a4812c0a1014ec7030191d13544c3b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Jonathan Gelie 4ba989f837 Bluetooth: Enable and disable BLE chip sleep mode dynamically
For power consumption matter, UART between quark and BLE chip shall
be disabled in absence of messages. GPIO NBLE_BTWAKE_PIN is used
from Quark to notify BLE chip payload is coming and so enabling UART.
The UART will be disabled by deasserted NBLE_BTWAKE_PIN signal, once
a message has been transmitted.

Change-Id: If538909784363f415f4266f62be57d8d9ff48b09
Signed-off-by: Jonathan Gelie <jonathanx.gelie@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 1254ac51ef Bluetooth: Controller: Fix assert on advertise start
Using the shell application, starting advertisement while
the scanner is already running caused the controller to
assert.
The work which is supposed to set the radio active state to
active is not executed before the radio ISR resets the radio
active state, causing the assert. This can happen when a
newly started role is initialized to setup the radio trx and
the radio start code then detects that its hard realtime
instant has passed (as time was spent setting up the ticker
and ticker then firing thereafter) and hence cancels radio
trx.
Optionally (without this commit), dynamic calculation of
preparation time can be disabled by setting a constant time
in the define RADIO_TICKER_PREEMPT_PART_US in ctrl.c to
avoid the assert.

Change-id: Ib4415ec4b1bfdcc89aa0f3912e5a8fdd2e817fde
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 22e3f62e07 Bluetooth: Controller: Fix coding style, use of (void)
Remove use of (void) before unused functions return values.
Replace use of (void) with ARG_UNUSED for unused parameters.

Change-id: I9ffea666f10dbdc01710df723e0df253a1cdd6e6
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Johan Hedberg 2599974189 Bluetooth: Controller: Fix coding style in ctrl.c, util/ and main.c
Initial sweep of controller code to fix the coding style.

Change-Id: Ib71c5a4657a1f162273f2dcd485fe70fff934928
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz 50997f2ccd Bluetooth: GATT: Add queuing support
This adds queueing support for requests that requires a response making
it simpler to use the API. The storage is keep in the parameters of the
request so it is up to the application to define how many can be queued
but in case the application don't want a request to block waiting for
a buffer it can use BLUETOOTH_ATT_REQ_COUNT to control the available
buffers which is recommended in case the requests will be sent from the
RX fiber.

Change-Id: I407c3982a7ecdc4a9eff7172d9d0addd46949783
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 5c01a7e3b3 Bluetooth: Controller: Add BLE controller driver
The main.c source file in drivers/bluetooth/controller acts as
the necessary glue between the Link Layer and Zephyr's
Bluetooth subsystem.  It instantiates the required RX fiber and
marshalls the control and data traffic between the BLE radio
and the BLE stack.

Jira: ZEP-702

Origin: Original
Change-Id: Ia62baedcd6e3ea83bd16306779357930f9a6c5f7
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 48c48711e6 Bluetooth: Controller: A full, hardware-agnostic BLE Link Layer
The ll/ folder contains a full implementation of a BLE Link Layer
interfacing with a baseband and a radio through radio.h. The
current code implements most Bluetooth 4.2 features and is
currently functional and tested with nRF5x ICs from Nordic
Semiconductor.

Jira: ZEP-702

Origin: Original
Change-Id: Ib79cd97142d1a72c99dcf2a88116ac97ddd90a2b
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada c160a0548d Bluetooth: Controller: Add initial HCI implementation
For the Link Layer to be able to communicate with the rest of
the BLE stack in Zephyr, this barebones HCI controller
implementation includes an initial version of the fundamental
commands and events required.

Jira: ZEP-702

Origin: Original
Change-Id: I38bc9dae34e7075ab8b8178fd6b6659e2dec53b0
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 0d3d1d5c83 Bluetooth: Controller: Add a util folder with basic primitives
The util folder contains memory management, queue management
and misc utilities used by the Link Layer implementation.
This will be in time replaced by Zephyr's native functionality.

Jira: ZEP-702

Origin: Original
Change-Id: Id8602ea41ec44811801dfc582bab244c339eabe3
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 87d4d27731 Bluetooth: Controller: Hardware abstraction layer for nRF5x radio
The drivers/bluetooth/controller path adds a native BLE Link
Layer (controller and HCI) to the Bluetooth subsystem. This first
implementation adds support for the nRF5x series of devices
from Nordic Semiconductor. The hal/ folder inside the controller
contains all IC-specific code to interface with the radio and
baseband.

Jira: ZEP-702

Origin: Original
Change-Id: I4ed61d5f67af6b4735d746a38a5b55f054521075
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko 6ab1b9cdc4 Bluetooth: Add RAW API interface to Bluetooth
HCI RAW channel API is intended to expose HCI interface to the remote
entity. The local Bluetooth controller gets owned by the remote entity
and host Bluetooth stack is not used. RAW API provides direct access
to packets which are sent and received by Bluetooth HCI drivers.

Change-Id: I4ba2b7ca2c2b0d6c5de6ef1f231d1c5b82125e09
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Kuo-Lang Tseng d30fd7ce82 driver: spi_flash_w25qxxdv: remove an incorrect erase size definition
The W25QXXDV_PAGE_SIZE is not a valid erase size supported by
the flash component (section 7.2.23 - 7.2.26 of datasheet
https://www.winbond.com/resource-files/w25q16dv_revi_nov1714_web.pdf)
and it is not used by any code so remove it.

Jira: ZEP-615

Change-Id: I4315fa082d5cbceda65ae8567e0a77e2d4066ef1
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-09-07 02:50:31 +00:00
Andrew Boie e98ac235e6 x86: declare internal API for interrupt controllers
Originally, x86 just supported APIC. Then later support
for the Mint Valley Interrupt Controller was added. This
controller is mostly similar to the APIC with some differences,
but was integrated in a somewhat hacked-up fashion.

Now we define irq_controller.h, which is a layer of abstraction
between the core arch code and the interrupt controller
implementation.

Contents of the API:

- Controllers with a fixed irq-to-vector mapping define
_IRQ_CONTROLLER_VECTOR_MAPPING(irq) to obtain a compile-time
map between the two.

- _irq_controller_program() notifies the interrupt controller
what vector will be used for a particular IRQ along with triggering
flags

- _irq_controller_isr_vector_get() reports the vector number of
the IRQ currently being serviced

- In assembly language domain, _irq_controller_eoi implements
EOI handling.

- Since triggering options can vary, some common defines for
triggering IRQ_TRIGGER_EDGE, IRQ_TRIGGER_LEVEL, IRQ_POLARITY_HIGH,
IRQ_POLARITY_LOW introduced.

Specific changes made:

- New Kconfig X86_FIXED_IRQ_MAPPING for those interrupt controllers
that have a fixed relationship between IRQ lines and IDT vectors.

- MVIC driver rewritten per the HAS instead of the tortuous methods
used to get it to behave like LOAPIC. We are no longer writing values
to reserved registers. Additional assertions added.

- Some cleanup in the loapic_timer driver to make the MVIC differences
clearer.

- Unused APIs removed, or folded into calling code when used just once.

- MVIC doesn't bother to write a -1 to the intList priority field since
it gets ignored anyway

Issue: ZEP-48
Change-Id: I071a477ea68c36e00c3d0653ce74b3583454154d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-06 18:35:47 +00:00
Andrew Boie c545e19a00 x86: remove dynamic interrupts and exceptions
Change-Id: I7e9756e9a0735a7d8257ee2142d5759e883e12cc
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-06 18:35:24 +00:00
Juan Manuel Cruz 77e09abdda ethernet: Enables multicast reception for dw driver
Jira: ZEP-471

Change-Id: Id6a3ecbe31c055ab006abe475650c9871460f671
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-09-01 11:04:14 +00:00
Qiu Peiyang c29087642b drivers/pinmux: delete unused file and Makefile item
According to commit 2055b06e ("quark: move pinmux files to board"),
drivers/pinmux/quark_mcu/ was deleted, so remove it from the Makefile.

According to commit 0ae2e895 ("remove custom pinmux for quark and use qmsi"),
pinmux_dev_quark_mcu.c is no longer compiled into image, so delete
this unused file.

Change-Id: Ied63cd3b06e8225205c5f1b3e5a675c387acb5ad
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-08-31 20:19:21 +00:00
Amit Kucheria 8fd658c06b drivers: spi: Fix typos in SPI port numbers
Also, SPI 0 isn't specific to Intel, make it a generic message. This patch
only fixes the cosmetics w/o changing undering Kconfig option names.

Change-Id: Ia58f9537c594004a1b5fb8b4af21d7e8b729efb7
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-08-31 14:41:36 +00:00
Ricardo Salveti 152ba4d736 serial/Kconfig.nrf5: cosmetic fixes
Change-Id: I84fe801f58345c362293cfe34b4cf6cd24041417
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-08-31 10:39:25 +00:00
Ricardo Salveti 2bd12cfd5b gpio/Kconfig.nrf5: cosmetic fixes
Change-Id: I06eb8854cab99d8666e51867d135026a9914648a
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-08-31 00:19:16 -03:00
Baohong Liu 1010927ba9 drivers: i2c_shim: fix i2c fast plus mode failure
Fix i2c failure seen on fast plus mode. With higher data
rate, signal ramp time becomes longer. The ramp time
required by the controller needs to be loosened.

Jira: ZEP-711

Change-Id: Icffa334ec3f059564e333d3b0759a11d1bebc5e4
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-08-30 21:09:49 +00:00
Andrew Boie 7a4afccfbf drivers: pci: fix incorrect printk() usage
Change-Id: I501bc86d04926c30a12b57211baddd93eed039d1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie c97aead1d2 drivers: ipm_console: fix incorrect printk() usage
Change-Id: I2a3fcce2ceef9b0034eabada59adc2d3c7b3d96a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie bf89e1756d drivers: console_handler_shell: fix incorrect printk() usage
Change-Id: Ifbe1a2a5eb9feaa30d5aa47dd81adfe4a188ea6f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Benjamin Walsh 36ece00163 arc/soc: remove unused CONFIG_TIMER0_CLOCK_FREQ
Defined in all SoCs, but never referenced anywhere. That definition has
been replaced by CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC.

Change-Id: I1801f72a03925717ded6fbfdef22b1993f843461
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-08-27 10:49:01 +00:00
Baohong Liu 9cfed4940c drivers: pwm_shim: correct api argument inconsistency
Correct the argument definition inconsistency for the set
value API. To be consistent with other pwm sub drivers, the
on and off arguments for the set value api are re-defined.

On: how far (number of timer count) from the beginning of a PWM
    cycle the PWM pin will be asserted.
Off:how far (number of timer count) from the beginning of a PWM
    cycle the PWM pin will be de-asserted.

Jira: ZEP-642

Change-Id: I7b39f98f1935fc3499fb36dd813abed62b86c1e7
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-08-25 14:24:03 -07:00
Anas Nashif 78ce02f86d quark_se_devboard: We do not support capabilities via Kconfig yet
This will lead to conflicts and warning coming from Kconfig, so just
whitelist the board in the samples where this hardware is supported

Jira: ZEP-739

Change-Id: I4a2f3bdcfdb44fc75df0e272c237789ee16e0de1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-08-25 06:12:00 -04:00
Jaakko Hannikainen db493450ac net: ip: Fix compiling with 15.4
Kconfig allows selecting NETWORKING_WITH_15_4_TI_CC2520 even if the
current board doesn't support it, and also selects it by default. This
breaks building the 15.4 sample with qemu_x86. Add a config option for
having CC2520 support and enable the choise only if it is available.

In addition, remove unused function from iee802154 code, as it now
fails the tests.

Jira: ZEP-697

Change-Id: Ib082f82acdd0f86d3306bbd3bb827f61b0fd0be1
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-08-23 13:13:59 +00:00
David B. Kinder d748577706 doc: Fix terminology in Kconfig files for 'platform'
Completing the terminology change started with change 4008
by updating the Kconfig files processed to produce the
online documentation, plus header files processed by
doxygen.  References to 'platform' are change to 'board'

Change-Id: Id0ed3dc1439a0ea0a4bd19d4904889cf79bec33e
Jira: ZEP-534
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2016-08-18 21:17:29 +00:00
Andrew Boie 533c2ee30d arc: fix management of IRQ priority levels
A previous re-work of IRQ priorities was led astray by an incorrect
comment. Priority level 1 is not a non-maskable interrupt priority.
In addition, zero latency IRQs are not implemented on ARC.

Timer driver now doesn't specify IRQ_ZERO_LATENCY (as that wouldn't be
correct) and its IRQ priority is now tunable in Kconfig. The default is 0.

IPM driver on both ARC and x86 side were being configured with hard-coded
priority of 2, which wasn't valid for ARC and caused an assertion failure.
The priority level is now tunable with Kconfig and defaults to 1 for ARC.

Issue: ZEP-693
Change-Id: If76dbfee214be7630d787be0bce4549a1ecbcb5b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-17 20:51:05 +00:00
Juan Manuel Cruz Alcaraz 6ec7fd5b42 enc28j60: Correction to ECON1.RXEN bit location
Per spec document, RXEN bit corresponds to bit 2
of the ECON1 register instead of bit 1.

Change-Id: I1bbfd048be248575a558679985ba9daadc43df0e
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2016-08-17 18:35:11 +00:00
Juan Manuel Cruz Alcaraz a1031ec5a6 enc28j60: rx fiber's stack size is increased
The rx fiber call contiki IP stack functions to register
received frames. This interaction requires more stack memory
in the rx fiber stack to avoid memory corruption.

Change-Id: I106339e7dd1ca9282426adfb54590e34297755b3
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2016-08-17 18:35:05 +00:00
Juan Manuel Cruz Alcaraz f53214e307 enc28j60: allow simultaneous reception and transmission
SPI bus is a shared resource between tx and rx processes.
The access to it must be synchronized to allow a rx process to
happen even when a tx process is taking place.
ECON1 register must be saved by the rx process and recovered
at the end to ensure that the tx process will continue operating
in the same register bank.

Change-Id: Ie9358bf02bef8ddb5bdf76c8847e998a627e5395
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2016-08-17 18:34:46 +00:00
Juan Manuel Cruz Alcaraz 2ac12e160c enc28j60: remove rx interruption handling
Transmision status is polled. Remove rx interruption enabling and
clearance.

Change-Id: I2893f89533adef5f77c711a36b5c1bbe21c48a23
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2016-08-17 18:34:46 +00:00
Juan Manuel Cruz Alcaraz 2f91a52519 enc28j60: hardware errata #14 ERXRDPT register failure
Even values in ERXRDPT register may corrupt the receive buffer.
Set ERXRDPT value one address behind the next value.
If it is zero, set the value to the reception buffer end address.

Change-Id: I7150e5190c5bfb7bfafbff598eea1c26959643d0
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2016-08-17 18:34:45 +00:00
Andrew Boie 926a368991 ipm_console: rate-limit to avoid losing messages
These console messages are for debugging and if sent too
rapidly, could be discarded. This was causing false positives on
test cases which rely on console output to determine success or
failure.

Issue: ZEP-704
Change-Id: I5a86c761311cde90f295cd2e65f2e70608f875fa
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-17 18:04:37 +00:00
Juan Manuel Cruz Alcaraz fd97f8addc enc28j60: hardware errata #6 PKTIF is unreliable
The Receive Packet Pending Interrupt Flag (EIR.PKTIF) does not
reliably/accurately report the status of pending packets.
Reception fails intermittently. The EPKTCNT register is used instead.

Change-Id: I599c3b4df1b74d769dd7104e5c6e253d9cf63bd4
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2016-08-17 17:19:37 +00:00
Andrew Boie a5b640eb18 ipm_console_receiver: correctly populate driver data
The (currently) unused ipm_device field wasn't initialized.

Issue: ZEP-704
Change-Id: Icbeb50031c52d2513a1417f83a844e25b43429a7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-17 14:23:34 +00:00
Baohong Liu e8a852325f drivers: i2c: Fix i2c failure on multiple slaves
Fix i2c failure while multiple slaves are connected to the
same i2c interface. Higher load on the i2c bus makes i2c
signal less nice. The requirement for signal ramp up and
ramp down time needs to be loosened.

Jira: ZEP-646

Change-Id: If698d7ba741788857694f166ecc602c2a94cb12e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-08-12 20:35:25 +00:00
Bogdan Davidoaia 966118ee18 sensor: hmc5883l: fix data sample axis order
The data sample registers are ordered as X, Z, Y (not X, Y, Z), so the
driver also needs to extract the sample components in this order.

Jira: ZEP-679

Change-Id: I317994bb545539b049e2ebf3d2af94e63c7d2511
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-08-11 17:29:50 +00:00
Baohong Liu 0ec26e9587 drivers: adc: Correct an error in Kconfig
Correct an error in ADC Kconfig. The # in the beginning of
the code lines unintentionally commented out the "if" condition.

Jira: ZEP-645

Change-Id: Ieee1bdbf4865fc39aef9a0986036fd81a75e5b58
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-08-11 03:11:28 +00:00
Andrei Emeltchenko ecdcbe5077 usb: Add error log to help debugging
Change-Id: Id320dc2b85f0a48a8f81425468aa3229b1e7d0cb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-08-10 15:27:36 +00:00
Juan Manuel Cruz 184a399f61 driver: ENC28J60 Ethernet SPI module
Adds the ENC28J60 Ethernet module driver.

Origin: Original
JIRA: ZEP-291

Change-Id: I2b5790ecb251f9059f172bcaafadef24bd27207a
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-08-05 20:36:44 +00:00
Baohong Liu 538d8d184d sensor: fix BMI160 sensor hang issue
Fix several issues which are causing the BMI160 app hang.

For SPI duplex transfer, QMSI only supports equal length.
For SPI freq, divider is used. Actual freq is no longer used.

Jira: ZEP-461

Change-Id: I1a1bcc12c6514c3797686dfdad1ce1b852f7dc78
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-08-05 17:35:42 +00:00
Julien Delayen 54b5085e8a uart_qmsi: Remove uart_qmsi_pm_save_config
One remaining reference to uart_qmsi_pm_save_config
was missed by patch bc60506d3e.

This reference is removed.

This fixes the following error:
...
drivers/built-in.o: In function `uart_qmsi_line_ctrl_set':
/drivers/serial/uart_qmsi.c:439:
undefined reference to `uart_qmsi_pm_save_config'
collect2: error: ld returned 1 exit status
...

Change-Id: I1ceda0e152db5a1c7f70d67c04b931416687031a
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-08-04 21:58:54 +00:00
Iván Briano 1a47abe5bf pwm qmsi: Add suspend/resume
Implement saving and restoring context of the PWM controller when the
application goes to SYS_PM_DEEP_SLEEP. No action is taken for other
states at the moment.

This functionality is implemented in the shim driver first to enable
the feature, but will later be moved into QMSI.

Change-Id: I5784f6a2c63caaea5785ca5d92bb6cc3bc9fa4cc
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-08-02 06:48:21 +00:00
Javier B Perez dfc15d3a48 driver: sensor: lsm6ds: remove dead code by kconfig options
Removed dead code inside sensor_lsm6ds0.h. There is no kconfig option
CONFIG_LSM6DS0_I2C_ADDR_6A neither 6B.
Also the #define LSM6DS0_I2C_ADDR is not in use.

Change-Id: Ib5a7f40d0d61542ed81687227df3795ba52ec725
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-08-02 06:47:39 +00:00
Amit Kucheria 975d92c038 soc: nrf5x: Add support to read and write to gpios
Change-Id: I9bded784c8e635a271b88a551b65b7268ea7e2d3
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-08-02 05:50:50 +00:00
Julien Delayen bc60506d3e uart_qmsi: Implement suspend and resume functions
In order to restore uart context after entering
SYS_PM_DEEP_SLEEP, suspend and resume functions
are called.

The following parameters are restored:
 - All registers for the UART device.
 - UART clocks.

The FIFO control register cannot be read back and is
not stored in the device configuration.
The default parameters are applied for them.

The suspend/resume functionality is implemented in
the QMSI shim layer as a fast and temporary solution,
it will be removed and migrated to QMSI later.

Change-Id: I4be9246f6aa5a6e0d91df54c1c69574060136607
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-08-02 05:38:01 +00:00
Genaro Saucedo Tejada 67c465d2cc sys_log: replace old debug macros at ieee802154 driver
ieee802154 driver is now using new system log macros, update the
Kconfig variable to be a level rather than a bool and the .conf
files at samples.

JIRA: ZEP-311

Change-Id: I640e973d880c3a222cd7c13a72d35edf49ada3a8
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-08-01 22:03:45 +00:00
Genaro Saucedo Tejada 7a0b987dc5 sys_log: replace old debug macros at DesignWare USB driver
DesignWare USB driver is now using new system log macros, updated
the Kconfig variable to be a level rather than a bool and the .conf
files at samples.

JIRA: ZEP-311

Change-Id: Ief46cadd954ca4b30a3a1cf2eba6e44ccbc9bc9f
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-08-01 01:54:56 +00:00
Genaro Saucedo Tejada aaa66ee9f2 sys_log: replace debug macros at Freescale K64 PWM driver
Freescale K64 PWM driver is now using new system log macros, updated
the Kconfig variable to be a level rather than a bool.

JIRA: ZEP-311

Change-Id: I80d01ba75e8b186ef32861b372af4e2d15dd4131
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-31 18:15:24 +00:00
Kuo-Lang Tseng 2f4975b625 qmsi: flash: Improved reentrancy of the soc flash driver
Calls to flash write or erase operations can get preempted
in the middle of the API call if a concurrent call (from
other fiber or task) to the same API is made. The patch ensures
concurrent API calls from other fiber/task is put on hold until
the current operation is completed.

The mechanism is by default not activated. To enable
it, the following flag needs to be defined:

CONFIG_SOC_FLASH_QMSI_API_REENTRANCY

Jira: ZEP-414

Change-Id: I39429e40cb6ed446123dd1a1d7c7acc1b12417aa
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-31 16:58:08 +00:00
Genaro Saucedo Tejada 93b9196ab9 sys_log: replace old debug macros at pcal9535a driver
pcal9535a driver is now using new system log macros and updated the
Kconfig variable to be a level rather than a bool.

JIRA: ZEP-311

Change-Id: Ic3d6c72630e66ac116c1e8954c32254677c51566
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-30 10:53:21 +00:00
Genaro Saucedo Tejada d0a588bb5a sys_log: replace old debug macros at GPIO drivers
GPIO drivers are now using new system log macros also updated the
Kconfig variable to be a level rather than a bool.

JIRA: ZEP-311

Change-Id: I9a49626d816080cb8081c2dd445bae31f5dbf409
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-29 23:10:50 +00:00
Iván Briano 4be7d42db8 i2c: Remove suspend and resume hooks from i2c_driver_api
Drivers that implement power management should use the preferred
device_pm_ops method instead.

Change-Id: I9ae06e26b77325265bbe46bdee82ba39dedb6b79
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-07-29 23:10:10 +00:00
Iván Briano fd8b0eaccb spi: Remove suspend and resume hooks from spi_driver_api
Drivers that implement power management should use the preferred
device_pm_ops method instead.

Change-Id: I337722b1e06afe8508b5c84c00c3542571232e07
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-07-29 23:10:10 +00:00
Iván Briano bce65437c0 spi: intel: Move suspend and resume hooks to pm_ops
The suspend and resume hooks in the spi_driver_api struct are relics
from before the current power management infrastructure was in place.
The correct way to implement this now is through the device_pm_ops
struct, by way of the DEFINE_DEVICE_PM_OPS and DEVICE_AND_API_INIT_PM
macros, which make the hooks available through a generic mechanism for
all devices, rather than using per-type APIs.

Since the existing spi_suspend() and spi_resume() functions don't check
if the driver_api hooks are NULL, there's now a place holder function
to prevent breaking functionality until the hooks are removed.

Change-Id: I48287c58e9a8649d3e1be7547e3d0d293c84327a
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-07-29 23:10:09 +00:00
Iván Briano c0eda9ec7e spi: k64: Move suspend and resume hooks to pm_ops
The suspend and resume hooks in the spi_driver_api struct are relics
from before the current power management infrastructure was in place.
The correct way to implement this now is through the device_pm_ops
struct, by way of the DEFINE_DEVICE_PM_OPS and DEVICE_AND_API_INIT_PM
macros, which make the hooks available through a generic mechanism for
all devices, rather than using per-type APIs.

Since the existing spi_suspend() and spi_resume() functions don't check
if the driver_api hooks are NULL, there's now a place holder function
to prevent breaking functionality until the hooks are removed.

Change-Id: I6a3e3db370860ad46f428d287943b1ca58a80ae1
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-07-29 23:10:09 +00:00
Iván Briano 20029c8c2d pwm: Remove suspend and resume hooks from pwm_driver_api
Drivers that implement power management should use the preferred
device_pm_ops method instead.

Change-Id: Ice9e0469a1fcb50eb64dcb240dddea56755b6e84
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-07-29 23:10:09 +00:00
Iván Briano 6e367c4db0 pwm: k64_ftm: Move suspend and resume hooks to pm_ops
The suspend and resume hooks in the pwm_driver_api struct are relics
from before the current power management infrastructure was in place.
The correct way to implement this now is through the device_pm_ops
struct, by way of the DEFINE_DEVICE_PM_OPS and DEVICE_AND_API_INIT_PM
macros, which make the hooks available through a generic mechanism for
all devices, rather than using per-type APIs.

Since the existing pwm_suspend() and pwm_resume() functions don't check
if the driver_api hooks are NULL, there's now a place holder function
to prevent breaking functionality until the hooks are removed.

Change-Id: Ib6b03053b483f97a1f7441af5ba51503270b8674
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-07-29 23:10:08 +00:00
Amit Kucheria 0017b60fbb soc: nrf5x: Disconnect GPIO input buffer when configured as output
This saves power.

Change-Id: Ie30bd3bffe89bc777d588fca56014634e03c0fe8
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-07-28 20:57:43 +00:00
Jani Pajarinen 485dde19da i2c: Fixed i2c_dw spamming when logs are enabled
Added CONFIG_SYS_LOG_I2C_LEVEL define, so that DW I2C driver will
not print traces unless requested with CONFIG_SYS_LOG_I2C_LEVEL.
Currently it doesn't obey it, so DW I2C spams DBG traces when
logging is enabled.

Change-Id: I87dc1d922ba61d39f26945627602864c75d9bf33
Signed-off-by: Jani Pajarinen <jani.pajarinen@intel.com>
2016-07-28 15:43:00 +00:00
Javier B Perez 33f048073f sensor: isl29035: fix undefined CONFIG LUX RANGE 4k in elif
Fixed undefined CONFIG_ISL29035_LUX_RANGE_4 in #elif

Change-Id: I2a7a6e46ffa0236da126d4e2c321e59302e54527
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-07-28 15:40:13 +00:00
Ricardo Salveti 81aa2b5d64 drivers/serial: fix nordic kconfig config string typo
Change-Id: Icc2d2582ae5105b6accfc4b8c2672a909e8f93e4
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-07-28 15:33:27 +00:00
Kuo-Lang Tseng 6911589c13 qmsi: pwm: Use locking mechanism to guard critical regions
Guard critical section of the driver API, so that multiple
simultaneous calls from tasks/fibers won't corrupt the driver
state.

The locking mechanism is by default disabled. To enable it,
the following flag needs to be defined:

CONFIG_PWM_QMSI_API_REENTRANCY

Jira: ZEP-430

Change-Id: Ia3eb2a962f4176a3ac94163b9843ab068abe4b4e
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-07-28 15:29:49 +00:00
Dragan Cvetic 021e09251a gpio_qmsi: Add suspend/resume
In order to restore GPIO context after entering
SYS_PM_DEEP_SLEEP, the suspend and resume
functions for GPIO and GPOIO_AON are called. The
following parameters are restored:
- All non-sticky RW registers for the GPIO device.
- The MASK register (interrupt routing register).

Note: No need to sve/resume AON_GPIO registers as
they all are sticky registers.

The suspend/resume functionality is implemented in
the QMSI shim layer as a fast and temporary solution,
it will be removed and migrated to QMSI later.

Change-Id: I68e25c9da4bb8ea65f312e3686d9ef090cb775ff
Signed-off-by: Dragan Cvetic <dragan.cvetic@intel.com>
2016-07-28 14:01:30 +00:00
Ricardo Salveti 9d033295ee drivers: Nordic nRF5 flash support
Change-Id: I366910fd55755602fd887e3ae47ae70144e4c99e
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-07-28 13:56:25 +00:00
Kumar Gala 902ddbe9c7 sensor: max44009: Fix Kconfig dev name typo
Code was using CONFIG_MAX44009_I2C_MASTER_DEV_NAME which doesn't exist.
Use CONFIG_MAX44009_I2C_DEV_NAME instead.

Change-Id: I6bf6eedd2229bb91f64264dc5b32e4a3c00921b6
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-28 07:21:49 -05:00
Kumar Gala 02b7088a10 serial: uart_qmsi: Fix typo in comments
CONFIG_UART_INTERRUPT_DRIVE should be CONFIG_UART_INTERRUPT_DRIVEN
CONFIG_UART_LINE_CTR should be CONFIG_UART_LINE_CTRL

Change-Id: I11fba5b387e3d36711cd3c813fc8a297ae23af05
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-28 07:20:12 -05:00
Kumar Gala 254836a716 gpio: nrf5: Fix Kconfig symbol issue
We don't currently have a SOC_NRF5 Kconfig symbol.  Utilize the
SOC_FAMILY_NRF5 Kconfig symbol instead.

Change-Id: I062ecab230e9e7814fad19517d28ddbbae66bccb
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-28 12:18:11 +00:00
Andrew Boie 0529c931a0 sensors: fix incorrect use of __ASSERT
__ASSERT was being used when __ASSERT_NO_MSG was appropriate.
This problem was previously only visible if CONFIG_ASSERT=y,
but a recent change to the assert macros fixed them so they
can't be improperly used with assertions disabled either.

Change-Id: I1e13c796873d79826d177a01246d2ca0e8f0a107
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-27 16:56:08 -07:00
Jithu Joseph f271d7dd3e qmsi: rtc: Use locking to guard critical section
Guard critical section of the driver API, so that
multiple simultaneous calls from tasks/fibers wont
corrupt the driver state.

The locking mechanism is by default disabled in the
build. To enable it, the following flag needs to be defined:

CONFIG_RTC_QMSI_API_REENTRANCY

Jira: ZEP-412

Change-Id: I430ebc07bf3277e5a5961cb6278c5500cd1e139b
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-27 22:17:20 +00:00
Jithu Joseph 3dd008e0c2 qmsi: wdt: improved reentrancy of the wdt driver
Uses locking in an API and removes a global variable
for improved safety/correctness in the face of concurrent
threads and fibers.

The locking mechanism is by default disabled in the
build. To enable it, the following flag needs to be defined:

CONFIG_WDT_QMSI_API_REENTRANCY

Jira: ZEP-440
Change-Id: Ibcd1501a4af628017b20d7e7ce20b988c8e4e4e2
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-27 22:17:09 +00:00
Iván Briano a52f8dcbee uart qmsi: Fix definition of device_pm_ops
The macro defining the device_pm_ops structs is located inside an
ifdef for CONFIG_UART_QMSI_0, so when the UART_0 is disabled at build
time, but UART_1 is still used, it references a struct not defined.

Fix it by placing the DEFINE_DEVICE_PM_OPS line outside the ifdef block.

Change-Id: I7dafda162741201ee47b5b480c07ec8c1f373d64
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-07-27 21:11:30 +00:00
Ricardo Salveti 180a0ee948 drivers: reverting Kconfig/Makefile changes for slip
The slip driver revert (3e63a74) was incomplete, missing the Kconfig and
Makefile changes, causing 'make clean' to fail.

Change-Id: I9d944148e6be3756b62d2371a5ab5528365e1ec1
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-07-27 16:26:51 +00:00
Baohong Liu db17939c8a drivers: i2c: remove i2c master idle check
The idle status check before a i2c transfer is not a reliable
way to check whether i2c master is ready to transfer data. If
the data transfer for the previous API call is done, but, a
stop condition is not sent by the previous API, the i2c master
is not idle, but, it can start new data transfer.

Change-Id: I93dbf46cef6272f3da69a0d67fb737c9b480791f
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-27 14:44:54 +00:00
Andrew Boie 96cadd1a9a arc: move special-purpose irq priorities to flags
We have already done this on x86 and ARM. The policy is as follows:

* IRQ priority levels starting at 0 all have the same semantics and
do not have special properties. The priority level is either ignored
on arches which do not support programmable priority levels, or lower
priority levels take precedence over higher ones.
* Special-case priorty levels are specified via flags, in which case
the supplied priority level is ignored.

Issue: ZEP-60
Change-Id: Ic603f49299ee1426fb9350ca29d0b8ef96a1d53a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-26 15:06:28 +00:00
Sergio Rodriguez b4d87a575a qmsi: gpio: Use locking mechanism to guard critical regions.
This will guard the driver API to be safe for concurrent
invocation from fibers or tasks.

The machanism is by default disabled. To enable it, the
following flag needs to be defined:

CONFIG_GPIO_QMSI_API_REENTRANCY

Jira: ZEP-441

Change-Id: Ia3ee738aff2f8e70e4f9a7ec76346138ff6f5031
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-22 23:26:34 +00:00
Sergio Rodriguez 3c5af9ab5b qmsi: gpio: quark_se_ss: Use locking mechanism to guard critical regions.
This will allow the driver API to be safe for concurrent invocation
from fibers and task.

The machanism is by default disabled. To enable it, the following
flag needs to be defined:

CONFIG_GPIO_QMSI_SS_API_REENTRANCY

Jira: ZEP-411

Change-Id: I5b738532f2eefec6d5d78ab6a668790dfe9faaff
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-07-22 23:25:31 +00:00
Andrei Emeltchenko 712689c9a3 drivers/nble: Use semaphore to control notification rate
At the moment firmware reads everything we send to it over UART and
when an application tries to send too much notifications we are stuck.
The proper approach would be forcing firmware to read from UART only
when there is available memory. In this case we would block on UART
FIFO and everything handles gracefully.
This workaround mimics solution used by firmware project by allowing
to send next notification only after previous was sent correctly.

Change-Id: I56dd5abc4d13735d285415da04db75e7bb8bc459
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-07-22 19:03:43 +00:00
Szymon Janc d2549115ca Bluetooth: Rename connectable_addr member in struct bt_le_oob
Depending on advertising options this can be non-connectable address.
NFC pairing application document also allows broadcaster/observer
roles.

Change-Id: I9b104ac8fb9752a083a7a31fc20598c66f23f608
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-07-22 13:09:30 +02:00
Inaky Perez-Gonzalez 3e63a74514 net/yaip: revert merge
Follow up to TSC decission for further discussion in the networking
WIG.

Change-Id: I148b484dfe308661573e47ed3e60cceed673bddf
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-07-22 04:43:09 +00:00
Ramesh Thomas 53bc73a438 uart: qmsi: Adds device suspend/resume to uart_qmsi device
This adds some basic suspend/resume support in the uart_qmsi
driver. This is part of a change to enable device suspend/resume
and deep sleep support in sample PM application.

Jira: ZEP-512
Change-Id: I38cfbfb352d0027b7beaadebedbc10002dade50a
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-07-21 11:25:31 -07:00
Ramesh Thomas 1171348038 rtc: qmsi: Adds device suspend/resume to rtc_qmsi device
This adds some basic suspend/resume support in the rtc qmsi
driver. This is part of a change to enable device suspend/resume
and Deep Sleep support in sample application.

Jira: ZEP-512
Change-Id: I79ccfb56de5b3cbfb5bc91e9cacca68554aa46ee
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-07-21 11:25:31 -07:00
Ramesh Thomas 8f0fdb668a timer: Adds device suspend/resume to loapic timer
This is part of a change to enable device suspend/resume and
Deep Sleep support in applications. Adds suspend/resume handling
in loapic timer.

Jira: ZEP-512
Change-Id: I9da2c8419bd9109fb71ef5a6caf736de7c7de9e1
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-07-21 11:25:31 -07:00
Murtaza Alexandru 0c83039a67 sensor: add driver for LPS25HB
Add driver for LPS25HB pressure and temperature sensor.

Datasheet:
http://www.st.com/content/ccc/resource/technical/document/datasheet/9a/4c/aa/72/1f/45/4e/24/DM00141379.pdf/files/DM00141379.pdf/jcr:content/translations/en.DM00141379.pdf

Change-Id: I6b616e879777b52f16f4e867c330e8beacf59fd3
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-07-21 16:22:03 +00:00
Kuo-Lang Tseng aebe38465f qmsi: aon counter: Use locking mechanism to guard critical regions of API call
This will guard critical regions in the driver API so that the API
operation called from one thread (task or fiber) can complete
without the context being over-written by any simultaneous call
of the API from other thread (task or fiber).

The locking mechanism is by default disabled in the build. To enable it,
the following flag needs to be defined:

CONFIG_AON_API_REENTRANCY

Jira: ZEP-424
Change-Id: I1b0eae70a4ab97229931033153662874d7c4a68e
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-07-21 02:05:43 +00:00
Ravi kumar Veeramally f93771a25c Revert "net: Restructured Ethernet driver menu"
This reverts commit 6de5643eb1.

Patch breaks applications running over Ethernet.

Jira: ZEP-565

Change-Id: Id147b7089f175c769c42c4e3dfb95408ee17ba9e
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-07-20 22:57:55 +00:00
Andrew Boie df72692fb6 sensor_bmi160: fix incorrect use of __ASSERT()
Change-Id: Ieb1d8b1aed3e9906d1377e1e4117b69eb8cae751
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-20 22:00:44 +00:00
Szymon Janc c6bcb591f6 Bluetooth: Add initial support for OOB data
This allows to query information needed for Out Of Band pairing
or connection creation. Currently supports only BT addresses.

Change-Id: I60bf9344baee552e7743fa8fc1b3cfb3a4765334
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-07-20 20:20:44 +02:00
Johan Hedberg 211ae314e8 Bluetooth: Pass net_buf_simple to scan callback
This lets the callback take advantage of the powerful net_buf API for
parsing the advertising data content.

Change-Id: Id65e6e83efd60c0f36c47bc5446a2e8ec2833d7c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-20 16:19:01 +00:00
Luiz Augusto von Dentz c51bcbb9d9 Bluetooth: GATT: Add write struct parameter to its callback
This makes bt_gatt_write consistent with the rest of the API where the
parameters are passed back to its callback.

Change-Id: Ie94208aa661d3620d0cbc5be4a4fb5b3c3ef061c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-20 13:40:55 +00:00
Andrei Emeltchenko 10411ed2f9 drivers/nble: Fix not setting user input expected flag
Fixes SEC/AUT/BV-11 PTS test case at least in GUI mode.

Change-Id: I60e7013f1c66027dabc1b94df87f2da991a5718c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-07-19 07:29:06 +00:00
Iván Briano c13a9cb02b ext qmsi: Make QMSI headers available to more than just drivers
QMSI provides more than just peripheral drivers, and it may be used
from the SOC or by applications that need finer grained control of the
platform.
This also makes the QMSI HAL consistent with the others.

Change-Id: I27490c98ccf1c1afcc090ce1e65f0e066eddc777
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-07-18 18:47:51 +00:00
Andrei Emeltchenko 9ddbf6a3a1 drivers/nble: Improve debug
Correct that handle is attribute one, print flag to notice cancel
prepared write requests.

Change-Id: I46d747f0466a44460e92fcbaef4e436066c09f4a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-07-18 09:34:20 +00:00
Andrei Emeltchenko 3a18f7e25c drivers/nble: Update nble_version structure
Add missing build_hash field.

Change-Id: Iee843b0354b7ab1699f75355542b719581b16b08
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-07-15 16:41:33 +03:00
Louis Caron beeafae556 Bluetooth: Align the NBLE firmware version and upgrade SD
The latest NBLE firmware includes a new version
exchange mechanism that is independent from the
RPC function definition.  It also allows using
firmwares that are automatically generated by
the official builders without needing a local
build.
The upgrade of the softdevice fixes several
issues in PTS tests.  The major change in
term of API introduced by this upgrade is that
upon write requests, the offset and data of the
write request must be sent back to the softdevice.

Change-Id: Ie574047a09a4e6fdcbf775bc98d8a61f981cee0c
Signed-off-by: Louis Caron <louis.caron@intel.com>
2016-07-14 13:59:39 +00:00
Andrew Boie a69ea78b8a _loapic_isr_vector_get: fix implementation
The comments state that higher-numbered vectors have priority,
but the function was doing the opposite. The code now agrees
with the comments.

Change-Id: I1a689fc22c8355458bdd734d95ff637da0655533
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-13 22:41:51 +00:00
Jani Pajarinen 6de5643eb1 net: Restructured Ethernet driver menu
Created menu for Ethernet driver and moved driver + debugging setting
under it. Changed prompt from "Grove log level" to more describing and
fixed typos.

Change-Id: If2f79fee1a002a42e89e2493a2294332abec05ee
Signed-off-by: Jani Pajarinen <jani.pajarinen@intel.com>
2016-07-13 14:33:44 +00:00
Tomasz Bursztyka 5c64a078f4 net: yaip: Removing capabilities() from net_if api
As there is a L2 in the middle, there is no need for a net_if to provide
such information.

Change-Id: I58a35d4d124cd8a67026f32e71713ef06f43b7c5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-07-13 14:06:21 +00:00
Tomasz Bursztyka d8f0b9ffed net: yaip: Add an L2 layer
Net core then does not know anything about l2 related logic.
For instance ARP is used in ethernet l2 API and nowhere else.
This will be helpful when adding different technologies altogether.

Currently, only SLIP driver is enabled to use relevant l2 layer.

Change-Id: I03c93326321028d04222733ca4083e3c6b785202
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-07-13 14:06:20 +00:00
Tomasz Bursztyka cd14d27e8e slip: Fix compiler warnings
2 warnings happens when CONFIG_SLIP_DEBUG is set, thus fixing it.

Change-Id: I032d7481942e86911764da35cdd6f7b8e05cdeaa
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-07-13 14:06:18 +00:00
Jukka Rissanen 2ee0d7bff7 slip: Support TAP functionality
If CONFIG_SLIP_TAP is defined, then ethernet link layer header is
used before the packet.

Change-Id: I3d266017f85683999d3c67de49b75b60686d7ba7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-13 14:06:08 +00:00
Baohong Liu a3488d13e0 sensor: add driver for MAX44009 light sensor
Add device driver for MAX44009 light sensor

Datasheet:
https://datasheets.maximintegrated.com/en/ds/MAX44009.pdf

Jira: ZEP-357

Origin: Original
Change-Id: I6b5c8e0afc36c22de0a6432d01cd5b7eb2e12f1b
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-12 19:31:09 +00:00
Andrei Emeltchenko bdb62b8934 QMSI/uart: Use IOAPIC_EDGE instead of IOAPIC_LEVEL
Use IOAPIC_EDGE instead of IOAPIC_LEVEL to fix missing interrupts.
During tests it was found that using IOAPIC_LEVEL interrupts for UART at
some points are lost.
Proposed by Calando, Antoine <antoine.calando@intel.com>

Change-Id: I18b20217c4d73fdeaa424bf59d00f6be1ec6ef1b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-07-12 19:30:31 +00:00
Jukka Rissanen de67431a43 net: yaip: Renamed network data receive function
Renamed net_recv() to net_recv_data() so that the more generic
name can be used by applications. The net_recv_data() is only
meant to be used when L2 layer feeds data into L3 (IP) layer.

Change-Id: Iba155d51f81e3b99964fa916fe87a05a8bf8766a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:52 +00:00
Jukka Rissanen fbb940d9f0 net: yaip: Receive IPv4 packet
Check if we have received IPv4 packet and call a handler
function to process it.

Change-Id: I9f9e5f0888d2c3b91401c98f4925647ddce09962
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:50 +00:00
Jukka Rissanen 184e251fdb slip: Add driver for host to qemu connectivity
The SLIP driver is using UART pipe driver to communicate with
host when Zephyr is running in Qemu. Currently this is only
used by networking sub-system when testing the networking
stack.

Change-Id: I432b4136670766a7fc190f146057924c266f9bea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:31 +00:00
Genaro Saucedo Tejada 9f48993d03 sys_log: removed unused macro at pci_config.c
Debug macro definition at this file was repetitive and has been
superseded by new system logging API. Furthermore it was not being
used on this .c file.
JIRA: ZEP-311

Change-Id: Id5828d1144fa03cc24f100ae94ecc596502c1131
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-08 19:41:50 +00:00
Genaro Saucedo Tejada 1c7e992e5d sys_log: replace old debug macros at clock control driver
Clock control drivers are now using new system log macros. also update
the Kconfig variable to be a level rather than a bool.
JIRA: ZEP-311

Change-Id: Ia64e79e4e083df580861f64c661f8dbaa8a3985d
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-08 19:41:26 +00:00
Adrian Bradianu 6840ee35a4 usb: dw: Protect FIFO writes
Protect FIFO writes against other USB register accesses.
According to "DesignWare Cores USB 1.1/2.0 Device Subsystem-AHB/VCI Databook":
"During FIFO access, the application must not access the UDC/Subsystem
registers or vendor registers (for ULPI mode). After starting to access a
FIFO, the application must complete the transaction before accessing the
register."

Change-Id: I2aed833acaa2970310b6fd48f41a95bee2182ec1
Signed-off-by: Adrian Bradianu <adrian.bradianu@windriver.com>
2016-07-08 18:22:18 +00:00
Genaro Saucedo Tejada 89e46d431a sys_log: replace old debug macros at i2c
Designware, Amtel and Quark SE i2c drivers are now using new system
log macros. also update the Kconfig variable to be a level rather than
a bool.
JIRA: ZEP-311

Change-Id: Iac009b20fb74deb8ce72098378651bbec3b2ef17
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-07-08 18:20:28 +00:00
Luiz Augusto von Dentz 46f48ffec8 Bluetooth: H5: Use delayed work API
This replaces the use of delayed fiber with delayed work which doesn't
require extra stacks.

Change-Id: I3db0c168baabea2503163e26020bf5e4971ce584
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-08 12:05:34 +00:00
Baohong Liu c5404e7c4f sensor: adc: Fix a bug in ADC QMSI shim driver
Correct ADC resolution definition and default value in Kconfig.
QMSI uses different definition for sensor. But, Kconfig did not
reflect the difference.

Change-Id: I8e57aa5670bff0e5b29bf0772159834e4b902d88
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-06 22:06:17 +00:00
Mariusz Ryndzionek 57afc5f851 sensor: tmp112: use arithmetic_shift_right helper function
Use the function provided in misc/util.h to do the sample
conversion.

Change-Id: I21179982b6001bf79448e4eb289e9cffaf97f3fb
Signed-off-by: Mariusz Ryndzionek <mariusz.ryndzionek@firmwave.com>
2016-07-06 22:04:25 +00:00
Sergio Rodriguez 9852ee5573 pwm: Implement set period and duty cycle API
This allow the PWM QMSI shim driver to implement the set duty cycle
API, and correct the behavior of Set Value

Jira: ZEP-69 ZEP-156 ZEP-158

Change-Id: I47744958fed889116fbb5024343ea00f76ed7706
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-06 22:01:51 +00:00
Baohong Liu 5846bb6d65 drivers: i2c: qmsi shim driver bug fix
Fix a bug in i2c_qmsi_transfer function in the shim driver.
The function did not wait for the completion of a msg transfer
before starting another msg transfer. Similar issue exists in
the i2c sensor shim driver. It is also fixed.

Change-Id: I1f8ad2281fa185d85db25a4682ed596c02ea322e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-07-06 17:43:49 +00:00
Andrei Emeltchenko a09a696ff0 Revert "uart: qmsi: Add driver API reentrancy support to UART shim driver"
Revert patch fixing Bluetooth application with Debug enabled crashing.

This reverts commit 029d3beb57.

Change-Id: I0004dae656ca5a0b44da9f12542088d47c38b837
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-07-06 16:58:59 +00:00
Jesus Sanchez-Palencia abd7496225 ext qmsi: Update to QMSI 1.1-Beta
QMSI 1.1 Beta is available on Github:
https://github.com/01org/qmsi/releases/tag/v1.1.0-beta

Update the QMSI drop we maintain in Zephyr and
keep the modification to qm_soc_regs.h introduced on commit
6b88a6b945 "ext qmsi: Add USB base and interrupt defines" since
that patch hasn't made into the QMSI 1.1-Beta release in time.

Also, fix the build where needed:
- add hard dependency from qm_i2c to qm_dma
- fix spi_qmsi_ss.c due to new parameter naming
- fix adc_qmsi.c and adc_qmsi_ss.c due to a new parameter

Change-Id: I01388c787f5ee6ee97fece2e42b24a717522207f
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-01 13:43:02 -07:00
Genaro Saucedo Tejada 7a6bab308a sys_log: replace old debug macros on K64 PSI driver
SPI drivers for K64 is now using system log.

Change-Id: Ifd0d321e2ff84c581261b7cb3a7a4485afbd67f6
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
JIRA: ZEP-311
2016-06-30 17:50:56 +00:00
Genaro Saucedo Tejada a679f32920 sys_log: replace old debug macros at ADC driver
ADC driver is now using new system log macros, also update the Kconfig
variable to be a level rather than a bool.
JIRA: ZEP-311

Change-Id: Iac96c37989e44484808ded515397d457186240e0
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-06-30 17:50:55 +00:00
Bogdan Davidoaia e8d0090808 sensor: tmp007: fix negative sample values bug
Fix bug that caused negative temperature values to be computed incorrectly.
The sign bit needs to be perserved, when extracting the data sample from
the TMP007_REG_TOBJ register.

Jira: ZEP-499
Change-Id: Idbebd48b3164d7d4883352ef7128ef73be70e1b2
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-30 17:50:05 +00:00
Mariusz Ryndzionek 65cc01ac16 sensor: adjust Kconfig file formatting
Add hyphens so that the .rst file is formatted properly

Change-Id: Ic798590d4a892f4f4d5312e86949db23a3b3abe0
Signed-off-by: Mariusz Ryndzionek <mariusz.ryndzionek@firmwave.com>
2016-06-30 17:49:50 +00:00
Adrian Bradianu ff712114ef usb: dw: Add Quark SE USB device controller driver
Quark SE USB device (Designware IP) controller driver implements
the low level control routines to deal directly with the hardware.
Only FIFO mode supported.

Change-Id: I086186df017734579f0363ed79effc1481ff32c2
Signed-off-by: Adrian Bradianu <adrian.bradianu@windriver.com>
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-06-30 00:21:39 +00:00
Szymon Janc 9c68fd4e5b Bluetooth: Add priority buffer for handling critical HCI events
Command Status, Command Complete and Number of Complete Packets are
used for driving TX fibers (HCI and connection). Missing any of
those event will lead to HCI traffic stall.

Priority pool will be used when critical HCI event is received
or normal pool runs out of buffers. The difference with priority
pool is that buffer from it must not be passed to RX fiber and
must be freed from bt_recv.

If driver knows HCI event opcode before requesting buffer for event
it may hint HCI core about preferred pool selection.

Change-Id: Iad14724945bb59721c5ffb6b62d5a8a3e3f70be7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-29 14:51:51 +00:00
Mariusz Ryndzionek c8a589e06e sensor: add driver for TMP112 temperature sensor
Add device driver for the TMP112 I2C temperature sensor

Datasheet:
	http://www.ti.com/lit/ds/slos887d/slos887d.pdf

Change-Id: I08208204cd8f377dc65378aaf2b92c7cdefe8d2b
Origin: Original
Signed-off-by: Mariusz Ryndzionek <mariusz.ryndzionek@firmwave.com>
2016-06-29 05:09:11 +00:00
Bogdan Davidoaia 4f80a44b1b sensor: add driver for HMC5883L magnetometer
Add driver for the I2C-based Honeywell HMC5883L magnetometer.

Datasheet:
	https://cdn-shop.adafruit.com/datasheets/HMC5883L_3-Axis_Digital_Compass_IC.pdf

Change-Id: I9ad56a7533d8d67402aa2ae2862ba339b04d3525
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-29 04:58:44 +00:00
Kuo-Lang Tseng e505c89109 driver: uart: shim driver changes to reflect qmsi changes
QMSI uart driver has removed qm_uart_get_config API. Updated
the shim driver to use alternatives.

Change-Id: I3ccfd0dfec3711d250de7d1004275d9b02d7477a
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-06-29 04:55:06 +00:00
Luiz Augusto von Dentz e9083dfcd7 Bluetooth: GATT: Add flags to attribute write callback
This adds flags parameter to write callback which can be used to indicate
that data only need to be prepared with use of BT_GATT_WRITE_FLAG_PREPARE
fixing qualification tests that needs to check authorization or other
errors that cannot be verified with just the permissions.

Change-Id: I3d662b2027718ffb52a280e3bbc9750be14f89ae
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-28 17:36:08 +03:00
Mariusz Skamra 22f3baac91 drivers/nble: Fix included services
This fixes the regression of included services in nble.
Because user_data of BT_GATT_INCLUDE_SERVICE points to the first
attribute of service to include, and the bt_gatt_attr_read uses
memcpy, the pointer to pointer is needed to copy the address contained
in user_data to the buffer.
With this patch, included services work on nble as well as Zephyr.

Change-Id: If360014675c399fafc365185d5c1e41c913c8109
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-28 11:01:44 +02:00
Mariusz Skamra db250496b9 drivers/nble: Fix missing return status assignment
Status shall be stored to be returned in the response to the
on_nble_gatts_write_exec_evt.

Change-Id: I03172e4b8833f83bd9b60f10d3cb52a067cc9f34
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-23 11:03:35 +02:00
Mariusz Skamra ab8ec1592d drivers/nble: Fix missing FIFO initialization
FIFO object has to be initialized before being used.

Change-Id: I3bd774f60e2585d09cfba657cb2aa50c95e0c2f5
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-23 11:03:34 +02:00
Andrew Boie 133dab4a63 altera_avalon_timer: new timer driver for Nios II
Tickless idle is not yet supported. We program the timer period
to the desired system clock tick rate (sys_clock_hw_cycles_per_tick).

This was renamed to the same name used in the Altera Embedded IP
Peripherals Guide; used by other CPUs than Nios II.

Change-Id: Ic4fca8c16b923295b77b63f98f45cd3483c5f560
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 19:00:35 +00:00
Andrei Emeltchenko fbffa2a12f drivers/nble: Fix not unref not connected conn
If conn is not in BT_CONN_CONNECTED state we get extra reference.

Change-Id: Id78db628e776576ea120bda08e3f906c221015c7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-22 17:27:56 +00:00
Baohong Liu 029d3beb57 uart: qmsi: Add driver API reentrancy support to UART shim driver
Global data and device setting can be messed up by concurrent
API calls. This change is to serialize the access.

Jira: ZEP-454
Change-Id: I520722aecab7db443d053fd45498a22e165889de
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-06-22 16:47:52 +00:00
Baohong Liu e4c765f40f drivers: dma: Add QMSI 1.1-based DMA shim driver
Add DMA shim driver based on QMSI 1.1

In order to enable this driver, the following options must
be set.

CONFIG_DMA
CONFIG_DMA_QMSI

Jira: ZEP-354

Origin: Original

Change-Id: I604cbf34e90f7653b956a6e4d428424beee3ef87
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-06-22 16:46:50 +00:00
Andrew Boie 25052517c1 uart_altera_jtag: add JTAG UART driver for Nios II
This currently only supports outgoing messages without interrupts.

Change-Id: I635562f47106eb6cdc7104a8160e431bebea25dc
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 16:42:19 +00:00
Mariusz Skamra cc1559ce56 drivers/nble: Add timeout before Conn Param Update as Peripheral
According to Core 4.2 Vol 3, Part C, 9.3.12.2,
The Peripheral device should not perform a Connection Parameter
Update procedure within T_GAP (conn_pause_peripheral) after
establishing a connection.

T_GAP (conn_pause_peripheral) is 5 seconds.
Fixes TC_LE_REJ_BI_01_C.

1/3   L2CAP   TC_LE_REJ_BI_01_C   PASS
2/3   L2CAP   TC_LE_CPU_BI_02_C   PASS
3/3   L2CAP   TC_LE_CPU_BV_01_C   PASS

1/3   GAP   TC_CONN_CPUP_BV_01_C   PASS
2/3   GAP   TC_CONN_CPUP_BV_02_C   PASS
3/3   GAP   TC_CONN_CPUP_BV_03_C   PASS

Change-Id: I66bf57a2b8323b748c15f61b2daecfaa435dbb69
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-22 16:01:48 +02:00
Andrei Emeltchenko a0204e22aa drivers/nble: Implement on_nble_gatts_notify_tx_evt()
Print debug statement allowing to track bugs with firmware, this also
removing Not Implemented warnings.

Change-Id: I15b77cd6efb5d9bc75910ef444f746c860ac3c6c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-22 13:12:37 +00:00
Mariusz Skamra ad02f94c29 drivers/nble: Fix return type
This function can return negative value.

Change-Id: If466897821a0d1b718ad210df208ce8a004b3da9
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-22 11:25:37 +02:00
Mariusz Skamra b2ba8fbd0c drivers/nble: Split writing part of on_nble_gatts_write_evt
To be reused by on_nble_gatts_write_exec_evt.

Change-Id: I2cb7f3b8e2c33cbede9af3f211e876c4038bef36
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-22 11:25:32 +02:00
Mariusz Skamra cad52d1a66 drivers/nble: Fix execute write condition
This fixes the condition that has to be checked while writting attribute
value. According to the GATT API, write() callback returns the "number
of bytes written, or in case of an error BT_GATT_ERR() with a specific
ATT error code".

Change-Id: I4268e1d0585f5ce816ad64ca62232b6d739b780a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-22 10:44:18 +02:00
Tomasz Bursztyka bf40601c2a cc2520: Fix how FREGs and SREGs are accessed
- SREGs should use MEMRG/MEMWR instructions, FREGs use REGRD/REGWR
- REGRD/REGWR get the register address in the first byte along the
  instruction.

Reported-by: Igor Modino <igor@emutex.com>

Change-Id: I0da9de5ecd4cab914c8711bd4276e7a2bc6147a5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-06-22 04:47:43 +00:00
Sebastien Griffoul 300dee8a26 serial: fix ns16550 set_baud_rate()
In order to change the baudrate the DLAB bit of the LCR register has to
be set to 1 (This bit is used to enable reading and writing of the 
divisor latch register). This bit must be cleared after the baudrate
setup in order to access other registers.

The set_baud_rate function correctly sets the DLAB bit of the LCR reg but
never clears it. Therefore the ns16550 doesn't properly work any more
after updating the initial baud rate.

In order to fix this issue the LCR reg has to be temporary saved
(because it contains other important settings). After switching to a new
baud rate the LCR reg value has to be restored. 

Change-Id: Ied4db683cbf40ba3125e747552968ddf1a66e2be
Signed-off-by: Jeremie GARCIA <jeremie.garcia@intel.com>
Signed-off-by: Sebastien GRIFFOUL <sebastien.griffoul@intel.com>
2016-06-22 01:35:37 +00:00
Louis Caron b7702334c4 drivers/nble: Update firmware to 0620 revision
Update NBLE driver to use the latest firmware fixing the
dependency on the bt_gatt_attr structure size.

Change-Id: Ib93d7d29656028bfb06bbb6ca883816e2a7072fc
Signed-off-by: Louis Caron <louis.caron@intel.com>
2016-06-21 09:24:10 +00:00
Andrei Emeltchenko 5dc16e0b8f drivers/nble: Indicate that there is no buffers for prepare write
Change-Id: Icb81e4be07e33e0eae6d0341847d2c68be091039
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-17 11:12:44 +03:00
Andrei Emeltchenko 93693e60c4 drivers/nble: Shorten on_nble_gatts_prep_write_evt() name
on_nble_gatts_prep_write_evt() indicates that this is IPC function
which is not true.

Change-Id: Ic0c5f12136a84abd7b8e6144f7ca67f9b36968fe
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-17 11:12:44 +03:00
Andrei Emeltchenko 4b5e220b1f drivers/nble: Update firmware to 0614 revision
Update NBLE driver to use the latest firmware fixing long write and
updating IO capabilities model.

Change-Id: Iea154f934dd6502fce3960763890ac15492c2952
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-17 11:12:44 +03:00
Kumar Gala b6dd6ec56b Bluetooth: H4: Remove unused board.h include
The board.h include isn't needed so remove it.

Change-Id: If6e2725007f340afd1b782c0278edd5317dfde0f
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-06-17 06:28:26 +00:00
Andrei Emeltchenko a31a9f9aa3 drivers/nble: Fix compile error with debug enabled
Change-Id: I9b9bff6562b58bbd57595d8ec33d960d1b15c908
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-15 14:47:39 +00:00
Andrei Emeltchenko c2ece8aec2 drivers/nble: Fix hanging conn reference
Remove gatts_write_evt() function since it takes conn reference and
forgot to de-reference. Use directly attr->write() instead.

Change-Id: I21737c8feda23ff7df154fcd72327b8ff2d59467
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-15 12:08:56 +03:00
Inaky Perez-Gonzalez d49d17f80b doc: remove *.h so documentation generation doesn't complain
With *.h added, the REST processor does not escape it and it thinks is
a non-finished emphasis line (*ddd*). Although the rest generator
should be fixed to escape those things, we don't have the resources to
tackle that and removing '*.h' doesn't alter the meaning.

Change-Id: I6b39551fc8d37d8dd63a68ed70619fc8fb64f2e5
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 01:44:54 +00:00
Johan Hedberg 4c95464b9e Bluetooth: Use proper net_buf APIs
Now that buffers can contain fragments we should always use the
net_buf APIs to read/write FIFOs and never the nano_fifo APIs
directly.

Change-Id: I203af43e887145a1b14f33a3729ef721fbd46469
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-13 17:22:05 +03:00
Johan Hedberg ebd5011adf Bluetooth: Update Intel copyright for files modified in 2016
Change-Id: I10a7cab9a7f911b9f64e17bf24ddce82c2f08c40
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-10 12:10:53 +03:00
Bogdan Davidoaia 44ef3c182b i2c: qmsi: remove duplicate I2C_QMSI_SS Kconfig option
Remove duplicate I2C_QMSI_SS option from Kconfig file, as there is no
reason to have it twice.

Change-Id: I602677676419c3f9581a606e8e3ebb889b439eb7
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-09 12:26:38 +03:00
Chuck Jordan db6adc6d2e int: Set default ARC interrupts to lowest priority to start
The code was setting the interrupt priority to 1 for each
vector to start. But I think it might be more appropriate
to set it to the LOWEST priority. Some ARCs will have
upwards to 15 priorities.

Change-Id: I9330ec8df323fe04ba0751faaafa39694f012364
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-06-09 00:34:03 +00:00
Johan Hedberg b76426de6f Bluetooth: Fix never yielding if rx_queue always contains data
It's common for the rx_queue to be written to in ISR context (by the
HCI driver). This means that if there's lots of data coming in from
the driver the rx_queue might get empty very rarely. With the current
code this means that the rx fiber might end up not yielding to other
higher priority runnable fibers for long durations (as long as there's
data in the rx_queue).

To solve the issue, call fiber_yield() explicitly after each processed
buffer from the rx_queue. This way we give other fibers a chance to
run even if there's a heavy flow of data from the Bluetooth
controller.

Change-Id: Ib3dbe6536a62360ad5153ed12eee8489645e4109
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-07 21:38:20 +03:00
Luiz Augusto von Dentz 56419a135b drivers/nble: Add buffer pool for prepare writes
This is similar to previous patch which makes the API much more simple
when handling long writes.

Change-Id: Ibd3856863a43927195e23936872a160d5ff94648
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:28:35 +00:00
Baohong Liu 44f0481979 drivers: gpio: Fix a gpio port read bug
address was passed to QMSi port read function, even though
value is needed.

Change-Id: I6b923fdc56114936fb4a0c55c923d6b37884e07c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-06-03 16:36:25 +00:00
Anas Nashif 1cb62d0372 i2c: qmsi: use I2C_SPEED_FAST_PLUS from API
Do not use the QMSI specfic define, use the one define in the
i2c API instead.

Change-Id: I979673e35060d041cb97f4de178069e2bdfd2c7b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-02 13:46:44 -04:00
Anas Nashif 5b202557d3 adc: qmsi: remove obsolete usage of QM_RC_OK
Change-Id: Ia34cc9d8b8b37a9157499be0843c5a42fec9a380
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-02 12:21:10 -04:00
Szymon Janc 07fb2e106b console: shell: Reduce stack usage of tab completion
Print commands names when matched instead of first creating
completion string in buffer. Common part of commands names
can only be reduced when matching further commands so only
first match needs to be kept for altering command line.

Change-Id: I5a9d2eb171ef4d31da9cbe6e93b577457b13c5a2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-02 13:28:15 +00:00
Johan Hedberg e8620aaada Bluetooth: Take advantage of net_buf_get_timeout()
Use the more explicit net_buf_get_timeout() call where it makes sense
(e.g. where we always want to wait or never want to wait).

Change-Id: Id1eabe0ad2f9fa79f7be39e51fefa5161f9cc550
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-02 10:32:29 +00:00
Andrei Emeltchenko 2b456dd120 drivers/nble: Implement on_nble_sm_security_request_evt()
Implement handling SM Security Requests. Fixes among others following
Bluetooth PTS test cases:

...
1/6   GATT   TC_GAR_CL_BI_05_C   PASS
2/6   GATT   TC_GAR_CL_BI_22_C   PASS
3/6   GATT   TC_GAR_CL_BI_27_C   PASS
4/6   GATT   TC_GAW_CL_BI_06_C   PASS
5/6   GATT   TC_GAW_CL_BI_24_C   PASS
...

Change-Id: Id35004a134bb9898e3b0dd51309f1762676ca579
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-02 12:08:54 +03:00
Kumar Gala 556b66f468 More cleanup whitespace in Kconfig files
Some additional whitespace converted to TABs

Change-Id: I945383f70960ad97e9cbc11ea96b099bcc558404
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-06-01 22:39:54 +00:00
Bogdan Davidoaia 4b00a69989 sensor: hts221: fix sensor type in Kconfig
The driver for the HTS221 sensor was added with the wrong type stated in
the Kconfig file, as it is a temperature and humidity sensor and not a
magnetometer.

Change-Id: Icc50c9b7ccc491b1c22e13d00607123a45338b11
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-01 14:25:27 +00:00
Murtaza Alexandru b3a485147f sensor: add driver for LSM6DS0
Add driver for LSM6DS0 accelerometer, gyroscope and temperature sensor.

Change-Id: Ic04fa8d0bbf935e7f04ed7981554d8095ceb5ccf
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-06-01 11:48:50 +00:00
Bogdan Davidoaia caa506102e sensor: ak8975: add support for MPU9150
The AK8975 chip can be packaged together with a MPU6050 chip, resulting
in a MPU9150 chip. In this format, the MPU6050 part of the MPU9150 chip
needs to be turned on and pass-through mode enable in order to communicate
with the AK8975 chip.

Datasheet:
	http://43zrtwysvxb2gf29r5o0athu.wpengine.netdna-cdn.com/wp-content/uploads/2015/02/MPU-9150-Datasheet.pdf

Register Map:
	http://43zrtwysvxb2gf29r5o0athu.wpengine.netdna-cdn.com/wp-content/uploads/2015/02/MPU-9150-Register-Map.pdf

Change-Id: I120dff11c187689e2e6968c812aae2e3e3578bc6
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-01 14:02:20 +03:00
Bogdan Davidoaia c4c01a92f3 sensor: add driver for AK8975 magnetometer
Add driver for the AK8975 3-axis electonic compass.

Datasheet:
	http://www.akm.com/akm/en/file/datasheet/AK8975.pdf

Change-Id: I427f954396c8991a153e4447d746b855d19cb60d
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-01 14:02:20 +03:00
Bogdan Davidoaia 01062d97aa sensor: add driver for MPU6050 sensor
Add driver to MPU6050 six-axis motion tracking device. The driver has support
for accelerometer, gyroscope and temperature channels.

Datasheet:
	http://43zrtwysvxb2gf29r5o0athu.wpengine.netdna-cdn.com/wp-content/uploads/2015/02/MPU-6000-Datasheet1.pdf

Register Map:
	http://43zrtwysvxb2gf29r5o0athu.wpengine.netdna-cdn.com/wp-content/uploads/2015/02/MPU-6000-Register-Map1.pdf

Change-Id: Id3930fc666195051093fee80c15cf2deb0eaedff
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-01 14:02:13 +03:00
Andrei Emeltchenko d00b9f0cb9 drivers/nble: Check existence of callback before call
Check that callback is defined before call, fixes issue in
on_nble_sm_status_evt calling cancel callback.

Change-Id: Ie2f49ed6e441f4260dacd16120e09f892c1fd528
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-01 08:21:18 +00:00
Sergio Rodriguez ab833c74c5 i2c: quark_se ss: Use locking mechanism to guard critical regions.
This will allow the driver to be safe from fibers and task

Jira: ZEP-411

Change-Id: I714f22c8df7002c45bed981c493e11af91c70d93
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-06-01 00:42:11 +00:00
Sergio Rodriguez 10e33ff779 i2c: Bug fix for the semaphore locking mechanism for i2c
The locking and synch mechanisms were configured after the interrupts
for the I2C controller are enabled, now the configuration is done before
the enabling of the interrupts.
Jira: ZEP-419
Change-Id: Ia1b0e790b9f5f8e7560cc3556b7a0f394048d171
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-05-31 22:54:55 +00:00
Sergio Rodriguez 7c00c4d3be spi:quark_se ss: Use locking mechanism to guard critical regions.
This will allow the driver to be fiber and task safe

Jira: ZEP-410

Change-Id: I61d3d9e4128bae781f1c86c07af79eb6e43ebeda
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-05-31 22:54:40 +00:00
Szymon Janc d1d0ee7b2d Bluetooth: Allow to call enable function only once
Currently enable procedure can be called only once regardles if it
failed or succeeded.

Change-Id: I3869e97442720860baba7bb1b7610738ca95561a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-31 11:37:12 +00:00
Szymon Janc d2fa54d4a6 drivers/nble: Use flags for state tracking
Using atomic flags instead of bool allows adding new states easily
without aditional memory footprint.

Change-Id: I0289a49af8353dc832a33e16ebdd6651c3913fe3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-31 11:04:41 +00:00
Andrei Emeltchenko 47d104530c drivers/nble: Call right function in bt_conn_auth_cancel()
Change-Id: I9e8ced163b95acbcb1835ed4b0de4fd110a2bd54
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-31 11:04:03 +00:00
Andrei Emeltchenko c42ea24886 drivers/nble: Refactor on_nble_sm_status_evt()
Remove NBLE_GAP_SM_EVT_START_PAIRING handling since this is handled
now in the special pairing event and defer negative status handling to
the actual event code processing.

Change-Id: I232d9e5ecd09b2600df3ff04128dfb7f71a2eae2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-31 11:03:40 +00:00
Andrei Emeltchenko 4a2afe4ade drivers/nble: Implement pairing confirm callback
Implement bt_conn_auth_pairing_confirm() callback.

Change-Id: I53f7fef05833e204e75aeb644efae8db10553e72
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-31 11:03:10 +00:00
Andrei Emeltchenko 0324f39313 drivers/nble: Implement passkey entry
Implement bt_smp_auth_passkey_entry() and bt_conn_auth_passkey_entry()
functions to be used by apps and tester.

Change-Id: I600284334c67840dd0c17991596ad31986bf0afd
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-31 09:49:34 +00:00
Andrei Emeltchenko ed044a7279 drivers/nble: Sync smp code for firmware compatibility
This moves SMP related code to smp.c making code similar to the tree
of firmware developers.

Change-Id: I5b43dcbe40a721e11b64cbdd4203406e721f40cd
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-31 09:39:25 +00:00
Szymon Janc 31912bcb23 Bluetooth: Constify bt_register_starage parameters
There is no need for struct bt_storage being modified by stack.

Change-Id: I732cf94983a29de40d692e802d6a71b8986708df
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-30 12:57:24 +00:00
Zhicheng Wei bd3043dc00 pci: fix typo in code example
Change-Id: I2d35c2110e387991f6daac5718f50ec66fc87a36
Signed-off-by: Zhicheng Wei <zhicheng@opensourceforge.net>
2016-05-30 12:54:20 +00:00
Andrei Emeltchenko a195351151 drivers/nble: Update RPC to version 0527
Update RPC to the newest RPC introducing some security improvements in
the firmware.

Change-Id: If031bb13927d63e029fcc6da34051257d13632a5
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-30 09:07:50 +00:00
Andrei Emeltchenko 979e10de6f drivers/nble: Fix NULL dereferencing
Fixes dereferencing NULL calling not defined function. Fixes PTS test
TC_GAW_CL_BV_01_C which was failing with the trace:

...
bt: on_nble_gattc_write_rsp (0xa80099e4): conn 0xa8008f60 status 0
***** CPU exception 6
Current thread ID = 0xa80099e4
Faulting segment:address = 0x00000008:0x40000000
eax: 0xa8008f60, ebx: 0xa8008f60, ecx: 0x00000000, edx: 0x00000000
esi: 0xa8009f88, edi: 0x00000000, ebp: 0a8009f80, esp: 0xa8009f70
eflags: 0x00010247
Fatal fiber error! Aborting fiber.
...

Change-Id: Ia76c2ad816e6427b353ab245855a1959c23c5feb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-30 08:59:10 +00:00
Bogdan Davidoaia 34f63de901 sensor: add driver for HTS221 sensor
Add driver for HTS221 temeprature and relative humidity sensor.

Datasheet:
	http://www.st.com/resource/en/datasheet/hts221.pdf

Interpreting humidity and temperature readings document:
	http://www.st.com/resource/en/technical_note/dm00208001.pdf

Change-Id: I1fee9d8372ad71b22bc85a60939c82f81569e135
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-29 22:25:19 +00:00
Bogdan Davidoaia a2605e50d7 sensor: add driver for LIS3MDL magnetometer
Add driver for the LIS3MDL ultra-low-power high-performance three-axis
magnetic sensor.

Datasheet:
	http://www.st.com/resource/en/datasheet/lis3mdl.pdf

Application note:
	http://www.st.com/resource/en/application_note/dm00136626.pdf

Change-Id: Id2d65e7525bef6c4fe50f86169a80f84197f8983
Origin: Original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-29 22:25:03 +00:00
Anas Nashif d8933d6c0a arduino due: move pinmux code to board definition
Change-Id: Id52ce660c059ebf47b2f989014faba715ed93c32
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-28 10:45:43 -04:00
Anas Nashif ffdd2e64dc pinmux: fix naming inconsistency
Jira: ZEP-288
Change-Id: Ie9bfd3ac95305a35c96453448d13d6b4cd6c0f0b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-28 10:45:43 -04:00
Anas Nashif 14e0aa396f pinmux: move galileo pinmuxing to board/galileo
Change-Id: I46da8ee9d9ec807c5a797ae3311519353d54e6c6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-28 10:40:48 -04:00
Anas Nashif 0ae2e895d2 remove custom pinmux for quark and use qmsi
Change-Id: I60757c1299df08bd9307d1602204eadce8121d60
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-28 10:22:31 -04:00
Anas Nashif 2055b06e4e quark: move pinmux files to board/
Move pinmux defintions under board/<board> and have all board
configuration in one single place.

Change-Id: I055b024384fae2938881b1c57d8ce7426e732e92
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-28 10:22:31 -04:00
Anas Nashif 37b1d1eb55 ext: include headers based on HAL being used
For CMSIS we now have HAS_CMSIS which needs to be added to the
SoC definition.
Instead of changing the main Makefile we now include a sub-Makefile
with all related header and library paths that are hosted in
ext/

Move redifintion of LIB_INCLUDE_DIR later to get variables defined
in Makefile.toolchain.*

Change-Id: I9f90f90247c2a66b4565427b89d4e1d4dd5c9622
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-27 01:38:23 +00:00
Carles Cufi 7923617c8f drivers: Add basic GPIO and UART support for nRF52
Add basic support for the Nordic Semiconductor's
nRF52832 (nRF52 series) GPIO and UART.

JIRA: ZEP-377
Change-Id: Ie3613956bae57829e26cb1cc20d3f740b5371f65
Signed-off-by: Glenn Ruben Bakke <glenn.ruben.bakke@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Håkon Alseth <haakon.alseth@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-05-27 01:38:21 +00:00
Baohong Liu 0ccc831452 drivers: PWM QMSI dev name fix
Change the dev name from PWM to PWM_0. This will make it
consistent with other drivers and also fix the device binding
failure in the PWM sample app.

Jira: ZEP-395

Change-Id: I90b945a7e57700d384eaa52e5300c881a3251d83
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-05-26 22:35:33 +00:00
Sergio Rodriguez c2a0a59481 spi: Use locking mechanism to guard critical regions.
This will allow the driver to be fiber and task safe

Change-Id: I916d4ad67ab6f51f41f3d1136c105e4d1445de48
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-05-26 21:41:00 +00:00
Sergio Rodriguez bf45b0bd87 i2c: Use locking mechanism to guard critical regions.
This will allow the driver to be safe from fibers and task

Change-Id: I6c4c4fc387cf334f0287b8a02982be1941a311fd
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-05-26 21:40:21 +00:00
Chuck Jordan d11ed0b13e spi: can use a tx threshold of 50%
The TX fifo threshold is pretty arbitrary.
Set this too big and too many interrupts will occur
for no good reason. Set it too small, and latency
in the SPI transactions is introduced. User's will probably
have to tune this per their application and SPI frequency, etc.
I think setting this to 50% is a good guess for now.

Change-Id: Ib325d40bc7ee10473d99443b3b3cd00fd6e4b95f
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-26 17:34:32 +00:00
Sebastien Griffoul 8237d0f882 eth: Fix spurious interrupt issues
The ethernet driver generates a lot of spurious interrupts.
These spurious interrupts have two sources:

1) The Mac Management Counter (MMC) module generates a lot of interrupts
   (GMI - bit 27 of the status register). Unfortunately the Interrupt
   enable register doesn't allow us to enable/disable it (bit 27 is
   reserved). Therefore the only way to mask this interrupt is to mask
   all the MMC interrupts (register REG_MMC_RX_INTR_MASK,
   REG_MMC_TX_INTR_MASK and REG_MMC_RX_IPC_INTR_MASK). By default
   these interrupts are not masked.

2) The RX interrupt is not correctly acknowledged. According to the
   datasheet, NIS is a sticky bit and must be cleared (by writing 1
   to this bit) each time a corresponding bit, which causes NIS to
   be set, is cleared.

Change-Id: I2033973849d87cddc328c65d0d4ad36b5a0c934e
Signed-off-by: Sebastien Griffoul <sebastien.griffoul@intel.com>
2016-05-26 15:12:25 +00:00
Szymon Janc 0595c47e17 console: shell: Add support for commands completion
This adds simple tab completion for shell use convenience.

Change-Id: If90ded32fb5044741232933d2cb0ce626227d025
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-26 13:06:59 +00:00
Szymon Janc d7e8fd0446 console: Add support for commands completion
This allows to register callback that will be called to
perform command completion.

Change-Id: Ide7a0427d9b8bb4dd8cfc0995ef2567b32e89632
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-26 12:02:51 +00:00
Ramesh Thomas a4568aac44 arc: fixes a missing declaration compile error
Building microkernel for ARC causes a compiler error
due to missing declaration of _sys_idle_elapsed_ticks.
Declare this as extern.

Jira: ZEP-397
Change-Id: I83701f693fea0fcb1ae2c30e0c52abe7987de1f1
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-05-26 02:15:06 +00:00
Chuck Jordan 528b04f520 gpio: more TAB cleanup in Kconfig.dw
I notice there are some more places in this file
that can be switched to using tabs.

Change-Id: I7dac2b91f932aa6f167b7eaf93e7c8f571a22d41
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-25 18:11:03 -07:00
Chuck Jordan c1e4bcf996 gpio: For ARC EM Starterkit, a 4-port GPIO implementation is being added
The file gpio_dw_registers.h already had the 4-port GPIO
registers defined, yet the gpio_dw.c implementation didn't
support it properly. There are 4 ports here, not 2, and only
PORTA can support interrupts and debounce.

On the em_starterkit board, for example, PORTA
has 3 bits for buttons: A, L and R. The other 3 ports should not
be used with interrupts & debounce.

I've re-worked this file to derive the port number from the
base address given. The lower 6 bits are divided by 12 to
derive the port number. From this, the registers EXT_PORTA,
EXT_PORTB, EXT_PORTC or EXT_PORTD can be read.

Also, for those ports that don't support interrupts,
set irq_num to 0, and that code will be avoided. I've verified
that I can access GPIO now correctly on the EM Starterkit. The
em_starterkit board support will be submitted soon but I'm
staging in this change first.

Change-Id: I98dbe083e03e046b40e07b4b14a99a39a6d0f0be
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-26 00:10:42 +00:00
Kumar Gala 9ec2f3be80 Cleanup whitespace in Kconfig files
Convert leading whitespace into tabs in Kconfig files.  Also replaced
double spaces between config and <prompt>.

Change-Id: I341c718ecf4143529b477c239bbde88e18f37062
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-05-25 13:28:07 -05:00
Andrei Emeltchenko 171dab4f22 drivers/nble: Defer GATT long write errors to execute response
Defer Prepare write errors to be sent in Execute write response
Per Bluetooth Spec. The Attribute Value validation is done when an
Execute Write Request is received. Hence, any Invalid Offset or
Invalid Attribute Value Length errors are generated when an
Execute Write Request is received. Fixes test case
TC_GAW_SR_BI_33_C (run with shell).

Fixes: ZEP-218

Change-Id: I3dc4583f519e0da2e1f741c9b532d6a6c1970225
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-25 16:44:55 +00:00
Mariusz Skamra 076df0ce73 drivers/nble: Fix GATT Server Indications
This fixes GATT Server indications.
conn handle shall be set to the valid handle, not 0xffff.
If conn passed to bt_gatt_indicate is NULL, indication will be sent
to every client subscribed.

Fix related to ZEP-403

Change-Id: Ie36b957fddfbc5485318bba649d15349e9293868
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-25 14:40:04 +00:00
ktseng be4ac5a3e9 flash: update API documentation
Fixed doxygen comments for flash API usage. Clarified the use of
flash_write_protection_set API for write and erase operations.

Jira: ZEP-383
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
Change-Id: I6a323915c63a393b7be8f96fe3fcd9616a9b21d1
2016-05-25 13:30:41 +00:00
Chuck Jordan 0fc41677b2 i2c: fix some spelling errors/grammar in comments
Some minor fixes to some comments

Change-Id: I0244d70c31b59ba189673e44c3919710414e9810
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-24 10:14:10 -07:00
Andrei Emeltchenko db6f45823f drivers/nble: Improve logging for long characteristic
Print flag for write_evt() to distinguish between write and
prepare_write. Add offset printing when reading.

Change-Id: I8b53d8f49657ade39b190ab33e99097bb172077c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-24 13:19:35 +00:00
Murtaza Alexandru c4425fd816 sensor: fix typo resulting in compile error
Fix a compile error when trying to set I2C address of LSM9DS0 Gyro to
VCC (0x6B) caused by a typo.

Change-Id: I27850ecd70e715a10b96572aedea0d237dd55cd5
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-24 11:36:33 +00:00
Chuck Jordan 2ae9689678 adc: some symbols didn't have depends on ADC and should
I noticed that even though I was building w/o ADC, that some
ADC config symbols were still defined. Adding some "depends on"
to clean that up.

Change-Id: Ie73d131ba1ad63b5f3d920e17b4c7b5a0d785609
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-24 11:33:48 +00:00
Jithu Joseph 09a0c2f619 pm/loapic: suspend/resume support for LOAPIC
Provide functions of saving and restoring LOAPIC
states to support deep sleep.

Jira: ZEP-223
Change-Id: I1fb427989b021ec8e3a4f6dd0f4766a214360621
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-05-24 00:31:38 +00:00
Jithu Joseph b1625df534 pm/ioapic: Add suspend/resume support for IOAPIC
Save and restore IOAPIC flags and irq to vector translation
info for supporting deep sleep.

Jira: ZEP-223
Change-Id: Ifc50a5a72699ff6782ad194d8e96b18fac34da18
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-05-24 00:31:38 +00:00
Jithu Joseph 05158f76d7 pm/apic: Keep irq to vector table in RAM when needed by PM
In scenarios where device PM is enabled and dynamic irqs are
used, move the irq to vector table to RAM and keep it updated,
so that we can use this to restore IOAPIC/LOAPIC vector entries.

Jira: ZEP-224
Change-Id: I0d4350d4e30f8ca337a2a1d4f012748c3cb450f4
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-05-24 00:31:38 +00:00
Jithu Joseph 7c29fefd7d apic : Refactor some macros into a header
Moving few macros into a header file.

Change-Id: I975e19ba518bd6184038d6c1715224be7190b3ad
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-05-24 00:31:37 +00:00
Anas Nashif 489f42328c qmsi: move drivers and hal to ext/hal
This is external source code maintained somewhere else. Put it
under ext/ for clarity and maintainability.

Change-Id: I9e7c9d0948a2ba893006e316dc21d9b1a9edfa93
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:32:30 +00:00
Anas Nashif 613304c95d uart: qmsi: do not include ioapic.h on non x86 systems
Change-Id: If3d63ec04003fbe97f4b981d9220bc6a8ba3e8f0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:32:10 +00:00
Anas Nashif 229980f33c adc: quark se: Add QMSI 1.1-based ADC shim driver
Change-Id: I330be6ae1fa16d66bfca0c2ae36664fc9c6d080d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:31:51 +00:00
Sergio Rodriguez 92e9ffe481 i2c: quark se: Add QMSI 1.1-based I2C shim driver
Add I2C QMSI shim driver for sensor system based on QMSI 1.1

Origin: Original
Change-Id: I9c8efe49e8e9b7a5f8496fa49beb68e409148be7
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:31:27 +00:00
Baohong Liu 2ddfe381b8 gpio: quark se: Add QMSI 1.1-based GPIO shim driver
Add QMSI 1.1 based GPIO sub-driver for sensor system.

Origin: Original
Change-Id: Ida5565a5911eb55651a11a4ac0b240c624f8e1ca
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:31:05 +00:00
Baohong Liu 35633586f2 spi: quark se: Add QMSI 1.1-based SPI shim driver
Add SPI sub-driver for sensor system.

Use SPI irq number definitions already in Zephyr header file.

Origin: Original
Change-Id: I215db3acc535093dd75c0817cbe5af77e6e76e16
Signed-off-by: Baohong Liu baohong.liu@intel.com
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:30:43 +00:00
Anas Nashif f7c5820f28 quark se: build sensor subsystem files
Change-Id: I4490823450dd5fab0c04bece9e61481958ab3843
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:30:25 +00:00
Anas Nashif f35d6e04e3 qmsi: update qmsi to 1.1 alpha
Change-Id: Ib35ebcb32954f764ef8e33f6a1c11ad9f63931bc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:30:04 +00:00
Grzegorz Kolodziejczyk 8c3189c646 drivers/nble: Update service db attributes handle
Attributes should have stored their own attribute handle after
registering service. Handle values are assigned to attributes after
registering service and stack has to copy them.

Fixes:
GATT   TC_GAD_SR_BV_03_C      PASS

Change-Id: I8463340960d663161d0f7990390e60f06a1c7259
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-23 16:49:08 +02:00
Luiz Augusto von Dentz 7941630e17 console: shell: Add return to command callback
This enable checking for errors and automatically print help string:

btshell> connect
connect <address: XX:XX:XX:XX:XX:XX> <address type: (public)>

Change-Id: Ie097ecddb72ab15bf6192e310d0bd839bfd251d5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-23 11:00:21 +03:00
Bogdan Davidoaia 72786486c6 sensor: remove CONFIG_SENSOR_DEBUG
Remove the CONFIG_SENSOR_DEBUG as it is no longer needed since switching
to SYS_LOG_* in the sensor susbsystem.

Also, use __ASSERT where CONFIG_SENSOR_DEBUG was used to validate
function parameters.

Change-Id: I80ed7209abfb92220fa229d246c5b3a43b887e32
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-21 21:20:13 +00:00
Chuck Jordan df962d9a0e spi: Stability improvements to the DesignWare SPI driver
I've found many problems with the SPI driver and this repairs many of them.

The baud rate divisor was being derived from the CPU clock. But, some
targets may have a seperate clock attached to SPI. If the soc.h file
defines the symbol SPI_DW_SPI_CLOCK, it will use this instead
of CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC for the baud rate calculation.

completed() had a mistake where it would terminate the SPI transaction
too early, well before the tx data has cleared the FIFO. I found I couldn't
drive an OLED display correctly because completed() was wrong.
The repair is to now consider a new flag called spi->last_tx,
which will be set after the TX interrupt occurs with nothing to send any
longer. There is also a while loop added to SPIN until BUSY drops.

Another improvement is that push_data will NOT consider RX fifo size
if there is no RX going on. The calculation here when RX is going on
could go negative. I've added a check for that and prevent TX handling
if RX buffer is full. I think that is the intention -- to deal with RX first
if its fifos are more full.

In spi_dw_transceive, if we are only doing spi_write w/o reading,
don't enable RX interrupts at all. The OLED I'm working with failed
to have a pull-up on MISO SPI signal. As a result, a huge number of
garbage RX events arrive, and the interrupt handler finds there is
no rx buffer, so it tosses the data. But this is a waist of realtime.
It seems WRONG to enable RX interrupts if its something your not using,
so software can GATE these spurious events in this way.

With these changes, SPI can be used much more reliably, with FIFOs
that are deeper, and SPI devices that only require TX.

Change-Id: I0fe0745f2381c61c8a19ce086496b422a32a30a5
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-21 00:48:16 +00:00
Luiz Augusto von Dentz 39a4b17f3b console: shell: Print empty string if no help is passed
Change-Id: I5469ea18e878b6053caa911350426853477b8a6a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-20 16:08:21 +03:00
Luiz Augusto von Dentz a1094e92d6 console: shell: Add check for command help
This checks if the command string is either NULL or empty since in these
cases there shouldn't be necessary to do any lookup.

Change-Id: I27e6d5b07ab4000cce93a4d1f7952e3c57672657
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-20 16:05:17 +03:00
Luiz Augusto von Dentz c643b426ac console: shell: Fix use of strncmp
Contrary to strcmp strncmp does not match the entire string only the
initial bytes passed as len thus causing a prefix match not a exact
match logic.

Change-Id: I85f96beb2249223f44c81c4efd6bd01bf2033a2e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-20 16:05:17 +03:00
Andrei Emeltchenko 1be6e1cb7d drivers/nble: Skip not matched UIIDs in GATT discovery
Firmware does not filter by UUID so we need to do this ourselves.

Change-Id: I55808836369194fbc5ea7c35db2c72fcda75e4eb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-20 11:06:52 +00:00
Andrei Emeltchenko 8d7fb04546 drivers/nble: Add debug uuid print in bt_gatt_discover()
Change-Id: Iaf400c1020cf29df780114428c61f9e91c6aac0c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-20 11:06:35 +00:00
Andrei Emeltchenko 46d825fdab drivers/nble: Check that attribute is withing range
Fix iterating all attributes

Change-Id: If9555a02e76368dbfb952ef0710100a7aef288bd
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-19 18:44:12 +00:00
Luiz Augusto von Dentz a4b26fadfe console: shell: Add help string to command table
This adds a optional help string to the command table which is printed
when user enters > help <command>.

Change-Id: Id3a8995bb6c4ff6b009418e31968c0677e6e4921
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-19 08:43:18 +00:00
Chuck Jordan 7f637af2bd spi: For spi_dw, added SPI_DW_FIFO_DEPTH as configurable paramter
When using the Synopsys DesignWare Synchronous Serial Interface (SSI),
the FIFO depth can vary from 2-256, depending upon how this module is built.
For quark_se_ss, it was using a depth of 8. For EM Starterkit, it will be
32. Adding this now as a configurable option. A larger FIFO really helps
reduce SPI interrupts.

Change-Id: Id2bc8470bfc08ab447d38b89c7904cff010c63bd
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-19 01:24:57 +00:00
Chuck Jordan f2fd12cc32 spi: add macro so that txftlr register can be read
Just as rxftlr can be read, a macro is needed so that txftlr can be read.
Symmetry.

Change-Id: Id987f700d89268feca60850f4fdf512f990f3ab6
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-18 23:18:19 +00:00
Chuck Jordan 0a5bc3b0d9 spi: DW IP can have 16 slaves + SINGLE_LINE IRQ configured in soc.h
A recent submission caused a build error for DW
CONFIG_SPI_DW_INTERRUPT_SINGLE_LINE because the symbols
CONFIG_SPI_<0,1>_IRQ went missing from Kconfig.
I think these should probably NOT be configurable, because
on an SOC, interrupt lines are hard. So I'm changing
the names back to SPI_DW_PORT_<0,1>_IRQ, with there
definitions originatig in the soc.h file.

Also, on DesignWare ARC EM Starterkit, the SPI interface
has 6 slave selects, but IP itself can handle up to 16.
Why does this start from 1 and not 0? Argh!

DBG_COUNTER_RESULT() should expand to 0 when not used.

Also, don't check version from DesignWare IP because
it can be different for each target.

spi_dw_isr() requires a cast when converting arg to dev.

Change-Id: I83d55e0405583e7cafab80b09cbef44e0f96fcb8
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-18 22:32:30 +00:00
Andrei Emeltchenko 39557c4706 drivers/nble: Update Nordic RPC to 0518 release
Fixes limited discov mode bug and GATT write long request.
1 mandatory and 9 optional PTS test cases.
Fixes: RTOS-1524
Fixes: RTOS-1551

Change-Id: Iac3618af8d840073b72503cfbdf34b80e4334074
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-18 18:36:26 +03:00
Murtaza Alexandru 310ed1e2e9 sensor: add support for BME280
* Rename BMP280 to BME280 which is a superset for the former.
* Autodetect device based on chip ID.
* Implement humidity fetching and reading for BME280
* Rename sample BMP280 to BME280

Change-Id: I565c769a7011e7496c9f1cad861d5ee311839b4f
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-17 20:07:34 +00:00
Murtaza Alexandru 261a448f33 sensor: remove unnecessary return variables
Remove unnecessary return variables (ret/rc) to reduce memory footprint.

Change-Id: Ifc22fd993b4f8f2d0cf992f620f53cc510add1fa
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-17 20:07:29 +00:00
Murtaza Alexandru 2d7ae8b249 sensor: migrate all drivers to new error code standard
Check if return value is negative when checking for errors, instead of
checking if it's 0.

Change-Id: I0b0af28c02b3760f3128e8cbe48908dabc89af88
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-17 20:07:24 +00:00
Murtaza Alexandru df20e3e4a7 sensor: add support for *_ANY get channel
Update all drivers that have vectorial data to return all 3 channels (X,
Y and Z) if the chan parameter is _ANY.
Also fix a compile bug in LSM9DS0 MFD driver.

Change-Id: I5bf261846bcd68c288b96997ff164726f75c151c
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-05-17 20:07:05 +00:00
uLipe adaeba2fa6 gpio_k64.c: configure pins as gpio alternate function in gpio_k64_configure()
Change-Id: I653602abeb99d4baf379e6175558c19c05678567
Signed-off-by: uLipe <ryukokki.felipe@gmail.com>
2016-05-17 15:44:35 +00:00
Andrei Emeltchenko 06e0201735 drivers/nble: Update RPC to the latest 0516 firmware
Change-Id: I8552c05be2eeee0c94fdea0a6378bebdd37c7d91
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-16 14:30:22 +03:00
Andrei Emeltchenko e79a2cfa0c drivers/nble: Update RPC to Nordic BLE firmware 0513
This is actually a revert from a previous revert. This updates RPC
following the very recent firmware development.

This reverts commit a146f9ef28.

Change-Id: I67b517c3959b5b78a5ef80fbb338d6cc66e43e8e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-16 14:18:46 +03:00
Bogdan Davidoaia c9caf1806a sensors: add driver for DHTxx sensors
Add driver for the DHT temperature and relative himidity sensor family.
The sensor has a single signal pin (in addition to GND and VDD) over
which communication is done in a half-duplex manner (see datasheet for
more details).

Datasheets:
	http://www.micropik.com/PDF/dht11.pdf
	https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT22.pdf
	http://akizukidenshi.com/download/ds/aosong/AM2302.pdf

Origin: Original
Change-Id: If8c8be73d7fdfef2ab2091bf9b8fe72bcd700ed1
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-14 00:31:43 +00:00
Vlad Dogaru 3a66946b0f sensor: Rework core to use workqueue API
Remove the homegrown sensor delayed work API in favor of using the
system-wide workqueue.  Drivers still have the option of using their own
fiber.

In a second step, drivers can be refactored to start and use their own
workqueue.

Change-Id: I70dea6fc2abcbc9e04ac1ed3c837483a3d3c4424
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-05-12 15:27:40 +00:00
Andrei Emeltchenko a1f7e480b1 drivers/nble: Call bt_conn_security() on start pairing event
Call bt_conn_security() the same way it is done in upstream code for
NBLE. Currently use BT_SECURITY_MEDIUM as default sec level.

Makes at least following cases pass:
...
1/6   GATT   TC_GAR_CL_BI_05_C   PASS
2/6   GATT   TC_GAR_CL_BI_17_C   PASS
3/6   GATT   TC_GAR_CL_BI_22_C   PASS
4/6   GATT   TC_GAR_CL_BI_27_C   PASS
5/6   GATT   TC_GAR_CL_BI_33_C   PASS
6/6   GATT   TC_GAW_CL_BI_06_C   PASS
...

Change-Id: I2a0c177a187db931e88e2f82a5bda1c0cc04a112
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-12 15:10:21 +00:00
Andrei Emeltchenko c4ec82cc89 drivers/nble: Implement bt_smp_auth_cancel()
Implement bt_smp_auth_cancel()

Change-Id: Id37709f3a86619ece400d1502da2ed7b83436e9b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-12 15:10:07 +00:00
Bogdan Davidoaia 2064f4a9cc grove: add temperature sensor
Add driver for the Grove Temperature Sensor which measures ambient
temperature.

Sensor reference page:
	http://www.seeedstudio.com/wiki/Grove_-_Temperature_Sensor

Change-Id: I4f56224be5fa7a968749d5d4df8cb99a462c3c21
Origin: original
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-12 12:11:04 +00:00
Bogdan Davidoaia 62c7a1338a grove: add light sensor
Add driver for the Grove Light Sensor which detects changes in ambient light.

Sensor reference page:
	http://www.seeedstudio.com/wiki/Grove_-_Light_Sensor

Origin: Original
Change-Id: I88ae20cc9faa8ab8f274b0bd7a114db5c1a87a91
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-05-12 12:11:04 +00:00
Anas Nashif 90db02786c eth_dw: use sys log interface for debugging
Change-Id: I40ad4d2aa0419a7439a2fc0883a83430fa755b84
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:27 +00:00
Anas Nashif ae97f6a4d4 spi: use syslog infratructure for debugging
Remove custom debugging macros and use SYS_LOG

Change-Id: I235935eeb9c14cba3f3c10a766a79e39d8a3971d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:27 +00:00
Anas Nashif fbe7d90ead spi: consalidate and simplify
Use the same Kconfig infrastructure and options for all SPI drivers.

Jira: ZEP-294
Change-Id: I7097bf3d2e1040fcec166761a9342bff707de4dd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:26 +00:00
Anas Nashif a2b9b4b71a spi: remove kconfig variables that can be define in headers
Most of the values are SoC specific and come from the SoC definition,
not need to define them in Kconfig.

Jira: ZEP-294
Change-Id: I962ce36b7e2361ea77ae4178bb7c86c19a241c4e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:26 +00:00
Anas Nashif 9096daa53f spi: intel: move soc specific values to header file
Most of the values are SoC specific and come from the SoC definition,
not need to define them in Kconfig.

Jira: ZEP-294
Change-Id: I7688ca523915e3fa8a1d28dea7a1d84a66b39d56
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:25 +00:00
Anas Nashif d0c4b30679 adc: unify kconfig variables and make them consistent
Change-Id: Icf102cf845f0917263d4286fec7a85112c7f8ffc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:25 +00:00
Anas Nashif 1d547699a5 aio: unify kconfig variables and make them consistent
Change-Id: Ic3e4f1142a3d4dcde5947586bb4ad86372b3f70b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:24 +00:00
Anas Nashif 1ee7175de9 rtc: unify kconfig variable names
Change-Id: I2adc0b21944fc0af85d40c09deac14bdbf134178
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:24 +00:00
Anas Nashif 72bf29eb03 watchdog: unify kconfig variables
Use consistent naming for watchdog drivers.

Change-Id: Idcec987253ce1b6230ccdf29cd8149d0bd705052
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:24 +00:00
Anas Nashif 82c969c8ae gpio: use consistent names for IRQ priority variables
Change-Id: I35ca4a13bb9dc0fd86298fa4fb17158b275dc9cc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:23 +00:00
Anas Nashif e1fea59671 gpio: GPIO_DW_BOTHEDGES_SUPPORT unused
Change-Id: I57adb395d308f01e469a2a88e0ad658169ffff72
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:22 +00:00
Anas Nashif 0140da310b i2c: unify kconfig options and share them across drivers
Reduces Kconfig variables by ~20

Change-Id: If39f7d49482d62417c621f98bc8c0c78df0d4139
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:22 +00:00
Mariusz Skamra 4e68ea947e drivers/nble: Notify about updated connection parameters
This adds a notify_le_param_updated function to call registered
le_param_updated callbacks with new connection parameters.

Change-Id: Idd660f7ca024c2f7712a6a41a51db77e4fc82a00
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-12 10:08:39 +00:00
Mariusz Skamra f4451c7030 drivers/nble: Update connection parameters on_nble_gap_connect_evt
This issues connection parametrs update on new connection event,
to mimic Zephyr stack behaviour.

Change-Id: Ic3fa86a02ff9a5135a026dfff6d2fbfb890656c1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-12 10:08:29 +00:00
Mariusz Skamra 5a9a5259e2 drivers/nble: Add bt_conn_le_param_update implementation
This adds implementation of bt_conn_le_param_update function.
Connection parameters can be only issued while in slave role,
because, nRF51 supports this procedure over L2CAP only.
Closes ZEP-222.

Change-Id: I2bb5f718b60b8be279f333c9721629662c029a32
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-12 10:08:14 +00:00
Mariusz Skamra 0b76866bab drivers/nble: Store new connection parameters
on_nble_gap_conn_update_evt gives information about new
connection parameters. These shall be stored in conn.
Closes ZEP-222.

Change-Id: I69e36136cfae98821b1f5467c72c94dbc6f1d10f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-12 09:39:11 +00:00
Mariusz Skamra 31f6af2e34 drivers/nble: Move bt_le_conn_params_valid function
This function will be used by bt_conn_le_param_update to validate
parameters.

Change-Id: Icd60d74dae3bf467af4b7277d1516b978ba937a5
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-12 09:38:52 +00:00
Mariusz Skamra 4e0f6b8758 drivers/nble: Fix setting connection role
According to the data from nble_gap_connect_evt,
role_slave is "0 if connected as master, otherwise as slave",
so to be consistent with our API, this shall be mapped to
either BT_CONN_ROLE_MASTER or BT_CONN_ROLE_SLAVE.

Change-Id: Icf31ef02ea178e04cb28b2611e09b06c23f49704
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-12 09:38:39 +00:00
Andrei Emeltchenko 7a51619d89 drivers/nble: Implement on_nble_gatts_write_exec_evt()
Implementing on_nble_gatts_write_exec_evt makes pass test case:
...
GATT   TC_GAW_SR_BV_06_C   PASS
...
Fixes: ZEP-221

Change-Id: I39a78887a990e37a75d9b025b3baf4dee3475bba
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-12 10:18:50 +03:00
Andrei Emeltchenko 51d607f9bd drivers/nble: Fix passing uninitialized req parameters
Fixes passing structure nble_gatt_write_params uninitialized.

Change-Id: Ic092257693eb50b902936f3a5355a6d0e31bc3fe
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-12 09:51:09 +03:00
Chuck Jordan 61c5531430 i2c: IC_CON_SPEED_MASK should be 2 bit mask
IC_CON_SPEED_MASK isn't used, but I see it was defined wrong.
It should be a 2 bit mask.

Change-Id: I1003ae13b831ff481574bcf956daf2c54dbe7e47
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-11 15:09:15 -07:00
Chuck Jordan 0ed3cf29c8 i2c: fix i2c_dw.c to have correct decl for i2c_dw_isr()
The function i2c_dw_isr() in this file appears to have the wrong
decl for the IRQ_CONNECT macro. It should be: void i2c_dw_isr(void *arg).
Also, at the 2nd use of IRQ_CONNECT there was a variable created
and then marked as UNUSED. I've removed this.

Change-Id: I3f2c4ecb5c13147d577c82a0ec4fe486ae38a475
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-11 21:18:48 +00:00
Anas Nashif 00664b5a41 galileo: set priority of ADC to 95
ADC should come after SPI.

Jira: ZEP-217
Change-Id: I1f72d675604b83d54a9268014be3b46d197d746d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-11 17:59:46 +00:00
Chuck Jordan 4ad41d8d7f arc: early init should invalidate d-cache and set vector table
Some ARC targets can have a data-cache. Although there is no special
instruction to clear exceptions during early init, it is necessary to
invalidate the d-cache BEFORE any data is fetched. The ARC on arduino 101
doesn't have d-cache, and will thus skip this d-cache invalidate.

Also, it is important to set the vector table base register to point to
the interrupt vector table EARLY, so that if an exception is encountered,
the correct vector table is found. Set this base only if it is found to be
different from the one compiled in to the code.
These initialization steps assure that proper exception handling
is in place during early init.

Change-Id: Ie8b5928e5813e104680a6d6510c85d32dc8ed8f3
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-11 11:10:52 +00:00
Luiz Augusto von Dentz 20bfb62308 drivers/nble: Make sure gatt_private is reset properly
gatt_private should be reseted whenever used otherwise other commands
may fail when attempt to use.

Change-Id: I8bdda3d5136368a8f37fd9e2afd97e0957c4e04e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-11 11:29:08 +03:00
Luiz Augusto von Dentz 777033f710 Bluetooth: GATT: Make bt_gatt_write take a struct
This makes bt_gatt_write similar to bt_gatt_read where the parameters are
stored in a struct which can be used to store intermediate values while
the operation is in progress.

Change-Id: I3c62af137b99985690cf88dcc37a977a0be891f5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-10 17:55:06 +00:00
Andrei Emeltchenko 6a3d32cbee drivers/nble: Update RPC version to 0510
Change-Id: Ied97eaedacfe8d3a053b0732f56791486d8c9561
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-10 10:41:52 +00:00
Mariusz Skamra 3828a2008a drivers/nble: Fix NULL pointer dereference
Due to the recent changes, read parameters pointer is passed as user_data,
not as gatt_private.

Change-Id: I08b59164acfec8d71801ae2a23ce51abad080dc8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-10 11:44:05 +02:00
Andrei Emeltchenko a146f9ef28 Revert "drivers/nble: Update RPC to Nordic BLE to 0509"
Revert to RPC to BLE Radio Module 0425 as it is going to be official
open source release beta.

This reverts commit a52d7d7fe0.

Change-Id: Ibdb98b26bcad0a04849e89622527884a2b67c8d4
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-10 11:56:02 +03:00
Chuck Jordan 7e8e620ddf gpio: For EM Starterkit, some additional GPIO register defines are needed
Comparing the Synopsys GPIO driver with the one here in Zephyr revealed
that some register symbols are missing. I am adding them now, and will
be working on getting GPIO working on ARC EM Starterkit board.

Change-Id: Ifccd1e225eb1373a31c6a5c51cf3927e42601d1a
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-09 21:51:54 +00:00
Chuck Jordan 49dec0dad5 arc: clarify in comment that ARC must have timer0
The timer implementation for ARC currently requires timer0 to be present.
I've added a comment that this is an assumption and to encourage developers
to build the ARC CPU with Timer0, when it is to be used with Zephyr.
There is also an optional provision for a Timer1. In future, this
code could be conditional to use either timer.

Change-Id: I4eb3aec59ba4e85f8b70d5531b21bdaab00b93bb
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-09 20:56:51 +00:00
Chuck Jordan 12e29fe653 console: fix spelling error in comment
consloe changed to console

Change-Id: Ie6d6bd7762f1ab1dae64a1f5ccbe7dbc651e8c0f
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-09 20:56:51 +00:00
Andrei Emeltchenko 22ac4fd13e drivers/nble: Fix passing uninitialized write request structure
Fixes using uninitialized structure nble_gattc_write_param in
nble_gattc_write_req().

Change-Id: I476a3b833994c422691bf96dc0b2174368c47fa6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-09 16:34:19 +03:00
Andrei Emeltchenko 9178dce953 drivers/nble: Fix passing uninitialized scan parameters
Initialize req to zero, fixing passing uninitialized use_whitelist,
scan_type in nble_gap_connect_req().

Change-Id: I57f957db81f6d7cd3e24e3e7393ba1f055b42330
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-09 16:33:24 +03:00
Andrei Emeltchenko 4616f07f51 drivers/nble: Increase RX buffer pool
Since RPC to the Nordic BLE module has no flow control increase
receive buffer pool to handle events from the module. Without this
NBLE stack is not capable of handling all events and we get "No
buffers" error message.

Change-Id: I0566b30a95ef0a027d4533c83c3c2915018a650a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-09 15:15:43 +03:00
Andrei Emeltchenko 5a97415bd5 drivers/nble: Fix memory leak with double connection create
on_nble_gap_connect_evt() gets called in a case of incoming connection
but also with outcoming one. In this case connection is already
created so we should use conn_get() instead of conn_new().

Change-Id: I2ed2d0a1844f653000a12eb0f54f52533856bf0d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-09 15:13:14 +03:00
Andrei Emeltchenko a314368aac drivers/nble: Increase debug for NBLE
Change-Id: I92fca3a8d28aa29f31d0c448b6b9bc9931ce2118
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-06 17:05:40 +03:00
Andrei Emeltchenko a52d7d7fe0 drivers/nble: Update RPC to Nordic BLE to 0509
Update RPC following major RPC update in firmware.

Change-Id: I4094b94319359a59164ac69394937ac1472b8cbe
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-06 11:28:34 +00:00
Vlad Dogaru 77850daf11 sensor: sx9500: fix compile error
Looks like this snuck in with the GPIO API migration.

Change-Id: Ib58142e134a779431bacf9ca75a66541bf63d5b0
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-05-05 19:06:16 +00:00
Szymon Janc a14c932d91 drivers/nble: Fix setting SCAN_RSP data twice
set_ad() already checks for length==0 so there is no need for
checking if sd is valid.

Change-Id: Idc0ce9135eca56a1e8057f3a2129adb0b5e5ddd7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-05 12:19:36 +00:00
Vlad Dogaru 149decdcf5 sensor: bmg160: fix compile error when not using trigger
Change-Id: If681ace87439daf6e6aa0ad70ac79a19827a2e73
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-05-05 12:00:20 +00:00
Mariusz Skamra 20c7f47fc0 drivers/nble: Pass read_params as nble user_data
Getting params from user_data seems to work now.

Change-Id: I81bccea9aa6994d3c09a3ff03a49fa6767e7305e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-04 15:24:00 +00:00
Mariusz Skamra ec8a92b93a drivers/nble: Fix NULL pointer dereference
In on_nble_gattc_discover_rsp conn->gatt_private is set to NULL prior
to calling this parser functions. This fixes this issue by passing
discover params pointer to these functions.

Change-Id: I6669cb0d16dc65d532e17f96ceb9cd94dbe6ce08
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-04 15:23:39 +00:00
cjordan 42f7741712 drivers/interrupt_controller: initialize only NUM_IRQS interrupts
Change-Id: I33b4d09bc9255ab75bd25ef8938fc37e74e81038
Signed-off-by: cjordan <cjordan@synopsys.com>
2016-05-04 14:55:10 +00:00
Andrei Emeltchenko 6e60fc8d7c drivers/nble: Update RPC function names
Updating function names prepares for firmware RPC update, to this
moment only names changed.

Change-Id: I8d19e83c5c88a4b41ed803e276652eb15e0d87b1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-04 14:23:17 +00:00
Andre Guedes ea6eac35bb pinmux_dev: Remove PINMUX_SELECT_REGISTER from quark_mcu driver
This patch removes the PINMUX_SELECT_REGISTER macro definition from
pinmux_dev_quark_mcu.c since it is already defined in pinmux_quark_mcu.h
(which is included by the .c file).

Change-Id: I468cf6a54fc30d681f42a59eb2c8401d2b180849
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-05-04 13:53:00 +00:00
Baohong Liu e4c1d07477 drivers: pinmux: Implement pinmux pin get API for QMSI shim driver
Add implementation for pinmux pin get API in the shim driver.
It is based on the function from pinmux_dev_quark_mcu.c

Jira: ZEP-189
Change-Id: Ib6673f90cfe8e367fcbd12ed546b1fa3af7e1dbf
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-05-04 13:48:26 +00:00
Tomasz Bursztyka 7cd63abccb ieee802154: cc2520: SPI workaround when QMSI drivers are in use
Current QMSI SPI API does not handle asymmetric tx/rx buffers, and thus
it's up to cc2520 driver to manage the tx dummy bytes.

Change-Id: I97900946bcd8d96e9f039646bccd765c574c363e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-05-04 13:47:17 +00:00
Johan Hedberg 58ab2526e8 Bluetooth: Make UART draining logic consistent across drivers
There's no need to drain twice if NRF51_PM is enabled, the draining
shouldn't use rx_ready(), and it should happen after disabling
interrupts. Also rename uart.h to util.h to avoid conflicts with
include/uart.h and remove the left-over ISR prototype declaration.

Change-Id: Id38110dd38cf48edfe4a7b8e2e68cd358a9aa5ea
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-04 13:37:44 +00:00
Andrei Emeltchenko 492448b0f9 drivers/nble: Refactor NBLE RPC function names
Update function names following firmware name changing.

Change-Id: I8b42c4d9f5c892abec10d8653544c3e03e4ee80d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-04 13:19:04 +00:00
Laurentiu Palcu 6f11e868b0 sensor: add support for BMG160 gyroscope
Datasheet:
http://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMG160-DS000-09.pdf

Origin: Original
Change-Id: I27469da8ff04c2eb26e92cc5d747b1bb8fee627b
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-05-04 13:13:59 +00:00
Andrei Emeltchenko ef3fd51ade drivers/nble: Refactor gap_internal headers
Change-Id: I9b3ea113df2759b6586c3767acbde644c4cd2fd4
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-04 13:07:31 +00:00
Johan Hedberg caf50a52ea Bluetooth: Fix draining nRF51 FIFO during init
It's possible that there's a queued event from the nRF51 at the point
where we start resetting it, resulting in the stack receiving two NOP
events. To prevent this, make sure to drain the UART while the
controller is in a powered off state.

Change-Id: Ic009e11c11ac750fc76c881c0ffe9bd12d38da0a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-04 15:05:13 +03:00
Szymon Janc 6d5ed390b1 Bluetooth: Simplify advertising API
Instead of requiring application to provide both advertising type
and address type used just require app to provide info if advertising
is connectable or not. Advertising type is set based on provided
SCAN_RSP and local privacy support.

When local privacy is enabled it is no longer possible to advertise
using identity address. If such feature is to be required later on
advertising options can be extended.

This gives BT stack full control over what type of address is used
for advertising and is a preparation for random address rotation
and OOB support.

Change-Id: I90e9a683ef3794f155707343c874f75585439325
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-04 11:11:34 +00:00
Andrei Emeltchenko 2b7f0c8ede drivers/nble: Implement notification for all conns
In a case connection is not known implement notification for all
connections the same way it is done for HCI stack. Attribute database
is scanned for CCC attribute and notifications are sent to all
connections.

Change-Id: Id556b4aa5af124aea672891ca89b278c71519643
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-04 08:29:20 +00:00
Andrei Emeltchenko d7a31fa726 drivers/nble: Implement bt_gatt_foreach_attr()
Implement foreach iterator for NBLE.

Change-Id: Iebc158121f7a860ce8827468d21a859e62753ed8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-04 08:29:08 +00:00
Andrei Emeltchenko bb96f90694 drivers/nble: Refactor CCC changed logic
Use similar to HCI stack cfg structure to keep value.

Change-Id: I54cf731971c5e2822385dc8eb295ce9951969af6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-04 08:28:56 +00:00
Andrei Emeltchenko 21f23c21ad drivers/nble: Save peer address with CCC write
Save peer address to use it with bt_gatt_notify()

Change-Id: Ie5e3af4cdc2d225c9572e010359f59323ae493a7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-04 08:16:10 +00:00
Andrew Boie 9433895954 nios2: basic build, non-functional
Basic build framework for Nios2. Everything is stubbed out,
we just want to have a build going so that we can start to
parallelize implementation tasks.

This patch is not intended to be functional, but should be
able to produce a binary for all the nanokernel-based
sanity checks.

Change-Id: I12dd8ca4a2273f7662bee46175822c9bbd99202a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-03 23:18:45 +00:00
Grzegorz Kolodziejczyk 3639ddb7a7 Bluetooth: drivers/nble: Fix calling cmd from discov callback
Private gatt data from connection is indicator if another operation is
pending. Some att commands may be called within discovery callback
like subscription on ccc (within characteristic discovery procedure).
Without clearing conn private gatt data member, leads to rejection of
called in callback att command due to being "busy".

Change-Id: I72a35ed82dac2f0538f2d1637163bd2302f0b072
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-29 10:50:10 +00:00
Mariusz Skamra 8adb16fc32 drivers/nble: Fix missing write flush() callback
This callback is needed to successfully perform write operation.

Change-Id: I09776dda16dac639320a7e83a66e7a9b31ebea6a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-28 17:34:23 +02:00
Mariusz Skamra 76b6716452 drivers/nble: Fix passing NULL pointer instead of conn to write() cb
conn object pointer has to be passed to the write callback instead
on NULL pointer.

Change-Id: Ifde88be0a43bcd9e1acbe11b16512776cd18fc66
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-28 17:32:05 +02:00
Mariusz Skamra a653f8a168 drivers/nble: Fix status returned from on_nble_gatts_write_evt
If attribute has no write callback, BT_ATT_ERR_WRITE_NOT_PERMITTED
error shall be returned.

Change-Id: I9277f8682597ee7f93a1267d2de31b3cc245f1cd
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-28 17:29:17 +02:00
Roger Lendenmann 3278f542eb Bluetooth: gatt: include service api definition proposal
* service include macro definition takes reference to
   first service attribute of the included service

Change-Id: Ib2b1defe2c99aea738da791af74a534d56025eae
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
2016-04-28 10:35:38 +00:00
Daniel Leung c977b1b8cd spi/qmsi: don't assign driver_api if init fails
Change-Id: Ia2225dc1a389c49ddb256e66bd0c4ee86e29c4cb
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-28 01:03:39 +00:00
Daniel Leung 75c4a181ab watchdog/qmsi: use new DEVICE_AND_API_INIT()
Change-Id: I118df1333524f774a80602f6a1f2ce95a6e4f1c1
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-28 01:03:39 +00:00
Daniel Leung cd1981ea04 rtc/qmsi: use new DEVICE_AND_API_INIT()
Change-Id: Ic780b87e7f9372af970d24443d1a231a2f2c513f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-28 01:03:39 +00:00
Daniel Leung bb7e4ffa6e pwm/qmsi: use new DEVICE_AND_API_INIT()
Change-Id: I2ec5bb2e00d78755f8db1e960f747f9099163eaf
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-28 01:03:39 +00:00
Daniel Leung 0eca2bfc98 counter/qmsi: use new DEVICE_AND_API_INIT()
Change-Id: I3a2eb5bfc7f131c9a700b2d96674c238482ef164
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-28 01:03:38 +00:00
Daniel Leung fbae4abf14 aio_comparator/qmsi: use new DEVICE_AND_API_INIT()
Change-Id: Iacc2a0d4772e26bf700da009ccdbb74138978ed9
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-28 01:03:38 +00:00
Daniel Leung b78c9b6a5d adc/qmsi: use new DEVICE_AND_API_INIT()
Change-Id: I56af7fa2d4b9bdc09928d6a1db79b0f37b9b5db5
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-28 01:03:38 +00:00
Tomasz Bursztyka 6fc7566cdd ieee802154: cc2520: Invalid argument should return -EINVAL
-EIO is an error code for operationnal error, not about invalid
argument.

Change-Id: I7064eaf01c6040d2e93ed43df3932d8baed1256e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-27 14:49:41 +02:00
Andrei Emeltchenko c6f9941311 drivers/nble: Improve debug
Add debug for bt_gatt_notify() and print parameters in
on_nble_gap_conn_update_evt().

Change-Id: I5b61b5dbf508a2ee8e0b79c8636bc2dc710fb2ef
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-27 12:02:33 +00:00
Andrei Emeltchenko 5a19423bb4 drivers/nble: Remove unneeded type cast
Since the header was updated type cast is not needed.

Change-Id: I6a232cd8515fb48ef2a0d16cc064effac7b80bfd
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-27 12:02:23 +00:00
Andre Guedes 580e659887 drivers: stm32: Include errno.h
The pinmux_stm32 and pinmux_dev_stm32 drivers use errno codes so they
should include errno.h.

Change-Id: I3fd19b338d5525f44207e8c770285ef218dd27a2
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-04-26 22:49:48 +00:00
Andre Guedes d38e2fa35d gpio: Fix returning codes
DEV_* error codes are deprecated and should not be used anymore. This
patch replaces DEV_* occurrences by the corresponding errno.h code,
according to the error code conventions.

Change-Id: I2f38c869b4e00d22145e24375796ba6bf216b084
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-04-26 22:49:48 +00:00
Andre Guedes 04cdf8b6e8 ieee802154: Fix returning codes
DEV_* error codes are deprecated and should not be used anymore. This
patch replaces DEV_* occurrences by the corresponding errno.h code,
according to the error code conventions.

Change-Id: I7b098a6107c390b46ed15aaeb9141627e9502727
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-04-26 22:49:48 +00:00
Murtaza Alexandru f169a66205 sensor: migrate all drivers to new SYS_LOG
Refactor all sensor drivers so that they use SYS_LOG instead of
decentralized systems/functions.

Change-Id: Ibd9443e06004341bc5e9afaf5b49bbec547e073d
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:11:05 +00:00
Murtaza Alexandru 52ccdada9c sensor: split lsm9ds0_gyro driver
Split driver for LSM9DS0 gyroscope in core functionalities and trigger.

Change-Id: I19736b65f45a6c4fc79a1f16423097b89accff24
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:10:56 +00:00
Murtaza Alexandru 28cf0c210a sensor: split bmc150_magn driver
Split BMC150 magnetometer driver in core functionalities and trigger.

Change-Id: I955ac39c2e995a81fa830776da9c0bcc38d9490a
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:10:41 +00:00
Murtaza Alexandru 075d081811 sensor: add driver for LSM9DS0 accel and magn
Add device driver for the multi function device (MFD) part of LSM9DS0:
accelerometer, magnetometer and temperature.

Datasheet:
  https://www.adafruit.com/datasheets/LSM9DS0.pdf

Change-Id: I00b9db2c69c6e5229269afacb02bf5f921edabe9
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:10:41 +00:00
Murtaza Alexandru 676b89cd1a sensor: make runtime configurable attrs continuous
Runtime configurable attributes are now matched with the smallest
available value that is greater or equal to the parameter instead of
returning -EINVAL.

Change-Id: I9ca8e2eba443fcd247c329c6ce71dc2167fb7f03
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:10:40 +00:00
Murtaza Alexandru f1b95df34e sensor: rename SENSOR_TYPE_* to SENSOR_VALUE_TYPE_*
Rename sensor_value_type enums from SENSOR_TYPE_* to more concludent
name SENSOR_VALUE_TYPE_*. This change is required if we want to
introduce SENSOR_TYPE_* (SENSOR_TYPE_ACCEL - if the sensor/driver
supports accelerometer, SENSOR_TYPE_MAGN - etc.) in the future.
Also it is more clear with this notation what these enums are referring
to.

Change-Id: Ic58e29288669e10c0695e0f86f59b0e57f7ac38c
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:09:41 +00:00
Murtaza Alexandru 1be6d1f6c8 sensor: add the posibility to fetch one data type
Now you can specify the sensor type you want to fetch using
sensor_sample_fetch_chan. This will inform the driver that you want only
one type of data updated, leaving the others unchanged and enabling
different sampling rates for multi function devices (MFDs).

Change-Id: I403e422dffadc697c19a5372ed55ed8f486a2607
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:09:41 +00:00
Murtaza Alexandru 82cca9c56e sensor: fix bmc150_magn compile error
Fix bmc150_magn compile error introduced in I2C register access API
migration patch.

Change-Id: I48f4d6405b4b7ae25beb0fbd46169eac3689ec8e
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:08:38 +00:00
Murtaza Alexandru db06b853d3 sensor: fix init driver_api
Assign driver_api only if *_init is successful.

Change-Id: Ib95cd358af358aec4fc58ff10dcede05fad00d0a
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:08:38 +00:00
Murtaza Alexandru 6542e03a33 sensor: refactor bmc150 and lsm9ds0
* Fix coding style so line length does not exceed 80 chars.
* Remove unnecessary casts
* Remove unnecessary variable prefixes (from *_fiber_stack to
fiber_stack)
* Rewrite lsm9ds0_gyro_channel_get into more readable form

Change-Id: I086562644f707d9d6538cb34d000012464b02fe3
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-26 18:08:38 +00:00
Johan Hedberg 6a075ace24 Bluetooth: drivers/nble: Initial implementation of bt_storage_clear()
Now that there's a helper for clearing nRF51-side bonds we can use
that in bt_storage_clear().

Change-Id: I9eea4b100834b150e7c55a5141f1624853335c0a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-26 15:21:36 +03:00
Johan Hedberg 0b68af523e Bluetooth: drivers/nble: Clear bonds upon init
To ensure reliable behavior when pairing we need to clear the nRF51
persistent memory upon init.

Change-Id: I204bb27e7c6e33dc5dd006ad9937645e907e770f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-26 15:08:34 +03:00
Bogdan Davidoaia c4878335c8 gpio: pcal9535a: use I2C register access API
Use I2C register access API for writing/reading registers.

Change-Id: Ic35b3e7159f9827f2d202d8cd1ae8f26ee6300f1
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-26 11:06:50 +00:00
Bogdan Davidoaia fb1ea43be2 sensors: use I2C register access API
Use I2C register access API in drivers of sensors that have
8-bit registers.

Change-Id: I33e016feff09be396eae70fb312de055c49caca7
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-26 11:06:50 +00:00
Laurentiu Palcu e7a8c7609a sensor: bmi160: fix regression
The regression was introduced by the following commit:

sensor: bmi160: Use the new GPIO callback API

The problem was that ipm context was not set when registering the
callback.

Change-Id: Icbe8fb9670b9e7e7d489e70adf93ff62fed98935
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-26 10:57:56 +00:00
Johan Hedberg 4832da8db7 Bluetooth: drivers/nble: Fix using too large buffer
The nble firmware supports a max ATT MTU of 23 (i.e. the default).

Change-Id: I70f55b00b50b2ad6540850d594a6d2fb89b11d1a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-25 19:21:28 +00:00
Johan Hedberg 39e63117c4 Bluetooth: drivers/nble: Fix passing NULL to attr->read()
We should be looking up the appropriate connection object and passing
that to the callback.

Change-Id: I04620b301541c8bda45f20e2b1dcca8f71562821
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-25 19:21:10 +00:00
Johan Hedberg 847703d91b Bluetooth: drivers/nble: Fix on_nble_gatts_read_evt() behavior
We need to reset len to 0 in case of failure to prevent the nRF
firmware from reading past the end of buffer. At the same time clean
up the code a bit.

Change-Id: I2ac9a86e0f7704ae55c9b2758e02dfadf650f549
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-25 19:20:58 +00:00
Anas Nashif 04e6243aa5 gpio: rename device name for AON GPIO
Change-Id: Iccd3790d3e7adbe790fe78755d297aad0ae97834
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-25 19:17:05 +00:00
Anas Nashif 5c30367a06 qmsi: gpio: add initialisation priority for driver
Change-Id: I4204d514f95c8e6e264a3cb71a2fa8eec8bab45a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-25 19:17:04 +00:00
Anas Nashif 9d8c332b21 i2c: use I2C_X nameing instead of I2CX
Other IOs use this format, so lets be consistent and use

I2C_0 instead of I2C0 and I2C_1 an instead of I2C1.

Change-Id: I591ab08e14bd533ef0fac38e596559da783863b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-25 17:01:48 +00:00
Anas Nashif 052664d282 aio: build only when driver is configured in
Change-Id: Ida1a108fe8af585ba0c518bcb216b6c0f3253ab4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-25 17:01:48 +00:00
Tomasz Bursztyka 559b768340 sensor: bmi160: Use the new GPIO callback API
gpio_set_callback() is meant to be deprecated and thus modifying the
driver to use the new GPIO callback API.

Taking the opportunity to use ipm API properly in order to remove the
struct bmi160_data singleton.

Change-Id: Iafcf3fed10bd286962829a4157effd054dd78c1e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-25 14:58:16 +00:00
Andrei Emeltchenko 0ff961fb29 drivers/nble: Update Nordic RPC to 0425
Update RPC to Nordic BLE radio module to 0425 revision.

Change-Id: Ieb79821acd5a8fbc4358ea5e1f258834a7932c2c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-25 15:03:53 +03:00
Johan Hedberg 6f6984129a drivers: uart_qmsi: Re-enable HW FC for arduino_101 & quark_se_devboard
On current Curie-based boards UART 0 is wired to the nRF51 BLE
controller and requires HW flow control to be enabled in order to
function. This patch restores the same behavior that was present
before the "qmsi: uart: use built-in qmsi driver" patch.

Change-Id: If7ea347f5ab8b460f39123dcc0d75d711a5a1c2a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-25 11:42:50 +00:00
Tomasz Bursztyka 51503a2388 cc2520: Using new GPIO API callbacks
Adapting CC2520 driver to use the new callback format. That way, cc2520
will work on boards where FIFOP and SFD are hooked to a different GPIO
controller.

Change-Id: Ia40b17867000de26f332f36422f84bb3f20be2aa
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-22 22:17:53 -04:00
Tomasz Bursztyka 62fcd4ca82 sensors: Using new GPIO API callbacks
Adapting GPIO based sensors to use the new callback format.

Change-Id: Ibdc68bf80a2ee42dcaf25c7a6e4431f9b64dc20a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-22 22:17:25 -04:00
Tomasz Bursztyka fea1c49ba2 gpio: Improve the public API to handle multi callbacks
Many sub-systems might require to set a callback on different pins.
Thus enabling it via changing the API.

It is also possible to retrieve private-data in the callback handler
using CONTAINER_OF() macro (include/misc/util.h).

Former API is still available, and is emulated through the new one.
Using both should not be a problem as it's using new API calls.
However, it's now better to start using the new API.

Change-Id: Id16594202905976cc524775d1cd3592b54a84514
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 22:15:12 -04:00
Jithu Joseph 18fc64dcff power_mgmt: Sample usage of device_xxx__busy() APIs
To show possible usage of the device_busy_xxx() APIs.
Meant to show how drivers and power policy manager can use them.

Change-Id: I49d1dedd9a7b8d6bf09080c6c7243f0666330941
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-04-23 02:14:21 +00:00
Anas Nashif 7c332df43b qmsi: use QMSI_LIBRARY instead of QMSI_DRIVERS
For linking with external library, use QMSI_LIBRARY and point
to path of the library using QMSI_INSTALL_PATH

Change-Id: Icd954188a26cc02074aa8fe08a4afdea31879f60
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Anas Nashif dcf2f48413 qmsi: pinmux: use built-in qmsi driver
Change-Id: I84064cd42d85a687a505473a012a07763b4301e8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Anas Nashif a6915c070d qmsi: spi: use built-in qmsi driver
Change-Id: Ic7e86e015d4beb11a01d75aa50bc50f95c784e5e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Anas Nashif 8e4f04d735 qmsi: spi: fixed warning due to const paramter in API call
Change-Id: I0cc6f5948a9f3d93aec970950c7b2db441bff570
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Anas Nashif a91b35b506 qmsi: flash: use built-in qmsi driver
Change-Id: I7e9fa271956c4e02998fa7f9cf19afcc3372f46f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Anas Nashif 1797c8f108 qmsi: uart: use built-in qmsi driver
Change-Id: Ie19aee8dad8ba082891f92a2d42dc71f4ac34dbe
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Anas Nashif b3e02b406a qmsi: adc: use built-in qmsi driver
Fix naming and use a global driver name for instance.

Change-Id: I30a54cb9c20773e1b6fdc57b934aa564612a6c45
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Anas Nashif 85b3c2c62a qmsi: gpio: use built-in qmsi driver
Change-Id: I11444bcc146dbc477bb605f6b405bee559716f2a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Anas Nashif 324a83bed7 nble: Use string name for GPIO driver
Do not depend on specific implementation of the driver, use
well-known driver name used across multiple IPs.

Change-Id: I823fcfa01ce1484dd89f6ade8fbe7017f2084bc6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-23 00:54:34 +00:00
Anas Nashif f4feacf8b2 qmsi: aon_counters: use built-in qmsi driver
Change-Id: I5df98e9eacf429f017a094c861dcf54ab61566c1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:46:29 -04:00
Anas Nashif b512681f8c qmsi: aio: use built-in qmsi driver
Change-Id: I24b227d9367a4f0144cb9fa968a51827f8c2dfc5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:46:29 -04:00
Anas Nashif 940d539834 qmsi: pwm: use built-in qmsi driver
Change-Id: I154840f704b9cfec269addaf3cbd7e71bb6310af
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:46:29 -04:00
Anas Nashif b46f9db04b spi: use global init priority
Do not have priority per IP, use one config instead.

Change-Id: Ieb2923d4749a294e2a1c677d47d56a14cee3f36d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:46:29 -04:00
Anas Nashif 82d4c96bd4 pwm: unify driver names
Use same string for driver name used for binding and fix
sample app to work with multiple drivers, not only DW driver.

Change-Id: I4d40aa9d4e83fcf16dc883bb74c3f0e3e30e3502
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:46:29 -04:00
Anas Nashif a7d3329694 qmsi: i2c: use built-in qmsi driver
Change-Id: I2e650198117128cec79a64abcd2cc065b5f9804c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:46:29 -04:00
Anas Nashif 98c09140f1 qmsi: watchdog: use built-in qmsi driver
Change-Id: I0cff75181bb2a51c91e6589f9624f0891db0b6e9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:46:29 -04:00
Anas Nashif 80e9d63dec qmsi: rtc: use built-in qmsi driver
Change-Id: If8e70c946f73abf03a695fecaeff30a9881f6e94
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:46:28 -04:00
Anas Nashif 987016b954 drivers: add qmsi files for Quark MCUs
This is from QMSI porject at https://github.com/01org/qmsi

The version included in this change is 1.0.1:

https://github.com/01org/qmsi/releases/tag/v1.0.1

commit: c902bc5143546b76a3708ddb465ea9b7a8bd314a

Origin: https://github.com/01org/qmsi
Change-Id: I983deb2cffe2f84b7b7f2dd381367863eab7c6d1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:46:28 -04:00
Johan Hedberg e3e91d3280 Bluetooth: Add name member to HCI driver struct
This is more of a convenience to let the driver identify itself in
debug logs and the monitor protocol.

Change-Id: I73351477e98d45d6344c180b8088bde29df6f7d9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Johan Hedberg 4488fc6cab Bluetooth: Move HCI device bus information to the driver
The bus that we notify over the monitor protocol is really driver
specific, so let each driver specify their bus type.

Change-Id: Ic3a086fcc06352dbf051e52cef5bf6b8696349ae
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Daniel Leung 267e6e639c i2c/quark_se_ss: make structs and functions const and static
() Make driver API into const, as it is not being modified
   at runtime. Saves 24 bytes of RAM by putting it into ROM.
() Make device config structs as static as they are local to
   the source file, and should not be referenced from outside at all.
() Same goes for the IRQ configuration functions, by declaring them
   static.

Change-Id: I5225dc550bdd65ec88a8930944da063efe16a3b2
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-22 12:32:26 +00:00
Andrei Emeltchenko 5860325b4f drivers/nble: Cleanup Nordic RPC code
Remove handling not used and obsolete function prototypes.

Change-Id: I6086f2e13efe7fc219f237dda710a545bec07612
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-21 15:31:09 +00:00
Andrei Emeltchenko 642d596d69 drivers/nble: Update RPC to 0422 revision
Update RPC adding gap_tx_power request and event. Corresponds to BLE
version ATLASEDGE/PVT/FACTORY-386-gc1f694b.

Change-Id: I7e47553af63c3c3405522e37f86d9004dcca46f7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-21 15:30:54 +00:00
Laurentiu Palcu e5dc7ac363 sensor: bmi160: switch to the new logging API
Change-Id: Id370e06e95528c223e09bb4110eeec3dcc2d4aef
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:15 +00:00
Laurentiu Palcu 8943f6c5ce sensor: bmi160: add support for triggers
Add support for anymotion and data ready triggers. Also, the user can
choose at configuration time the source of the triggers. For quark, in
particular, since the current driver for ARC does not allow receiving
interrupts from AON GPIO controller, IPM is used: a helper app on x86,
registers a gpio callback and will 'relay' the interrupt, through IPM,
to arc core.

Origin: Original
Change-Id: I170d723425c6280f9aa8c240b66275647723edd9
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:14 +00:00
Laurentiu Palcu f71df44204 sensor: bmi160: make some read/write functions global
These will be needed by the trigger implementation.

Change-Id: Ib408ae540571447059301046a3486cedffa735d5
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:14 +00:00
Laurentiu Palcu 5609ec95ee sensor: bmi160: fix bmi160_reg_field_update function
A mask was not applied on the shifted value, hence allowing one to pass
a val that would change other fields in the register.

Change-Id: I3c7bdb24c7b3a0ce94f664dbba303db35660ce7b
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:14 +00:00
Laurentiu Palcu 77e28d2263 sensor: bmi160: create two wrappers for bmi160_reg_val_to_range
These will be used in the trigger implementation, which is a different
file, and will allow for the arrays to be static.

Change-Id: Ia34ebe9bde7d09abe8e93f3ace9e282cee1169db
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:13 +00:00
Laurentiu Palcu 6330388bf5 sensor: bmi160: move the printing macro to the header
The macro will be used in the upcoming trigger file.

Change-Id: I57a570fde37f31771b3d8bb9c028520fdc41da8f
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:13 +00:00
Johan Hedberg b090d75d62 Bluetooth: drivers/h5: Remove redundant BT_DBG()
Change-Id: I90e7caadfb357c1c2451b0108d11ce57c0dae77a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-21 10:41:48 +03:00
Andrei Emeltchenko 503d01a96c Bluetooth: Fix typo tupe to type
Fixes compilation with debug for drivers h4 and h5

Change-Id: Ia09ce0a5ca3d684a4f9d25fdfe8530e80a46afac
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-21 10:09:30 +03:00
Yannis Damigos de22f4e55e boards/olimexino_stm32: add new board
Add configuration for OLIMEXINO_STM32 board.
By default, the UART console is forwarded to USART1 available on
UEXT connector. All GPIO ports available on the connecot headers
are enabled.

Change-Id: I60b3ff20ea60b5294a3a6c31f4dba0802794f9d8
Origin: Based on nucleo_f103rb board
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-04-20 22:29:01 +00:00
Johan Hedberg 560956c54d Bluetooth: Kconfig: Split debug selection into a choice
This prepares for adding other debug types besides the printf-style
logging to the console.

Change-Id: Ic2ed305192491734da991c4f61fdaace03fd60f2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-20 17:46:09 +03:00
Bogdan Davidoaia b628aa8a87 sensors: bma280: add support for BMC150 accelerometer
Add support for BMC150 accelerometer which differs from BMA280 only in
id, I2C address and acceleration data width.

Change-Id: Iccf47ecc5de9fdb1b9e45f1561c5dbb54f720806
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-19 18:40:43 +00:00
Bogdan Davidoaia 0eec9492fc sensors: bma280: fix accel data sample calculation
The values from the accel data sample msb and lsb registers need to
be concatenated (using bitwise or) and not added, since together they
represent a single 14-bit value.

Change-Id: I476f05512beb3d6b81bacefd4c52e4b2a541708b
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-19 18:40:43 +00:00
Bogdan Davidoaia 62fca8fcc1 sensors: bma280: compute accel scales based on data width
Compute acceleration data and threshold scales based on data width and
acceleration measurement range instead of defining LSB values for each
measurement range.

Change-Id: I2a15877cef00d49d7a64fd6f6003722bb9f80b92
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-19 18:40:42 +00:00
Johan Hedberg d458c616df Bluetooth: Add missing debug log to HCI driver send()
Change-Id: I0842675192cd1fbf3997a8f0d4906f114c0489c1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-19 14:39:55 +03:00
Anas Nashif 65c06afa58 kinetis: reorganise soc directory using soc family
Add Kinetis SoC family and rename fsl_frdm_k64f to mk64f12.
This will allow adding new SoCs of the same family and the reuse of code
among SoCs of the family and series.

Change-Id: Iea1a663aef7ce0487f147bdd36f668bebe80deb5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-18 21:24:58 +00:00
Anas Nashif 4b411b34a1 stm32: rename SOC_STM32F1X -> SOC_SERIES_STM32F1X
Use SOC_SERIES_* for naming SoCs with similar features and architectures
with the goal of code reuse. The Series in the config variable should avoid
name collisions and clearly denote the relationships within an SoC family.

Change-Id: I7a98542f96b5d5dc3acc23782c4d45f98cceb599
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-18 21:24:58 +00:00
Anas Nashif 9bf2da7ef4 stm32: rename CONFIG_SOC_STM32 -> CONFIG_SOC_FAMILY_STM32
Use CONFIG_SOC_FAMILY for the top level SoC family. A family
will have different SoCs or different SoC series with multiple
SoCs.
Adding the Family string to the config variable to avoid confusion
between actual SoCs and families and to prevent name collisions.

Change-Id: Ic99a2c1df7850dee3a45641027af82464dd6fadb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-18 21:24:58 +00:00
Daniel Leung 5250283c33 i2c/quark_se_ss: fix RX request pause conditions
The driver should not request any more bytes if it expects no empty
space in the FIFO. So fix the bail out condition to (<= 0) instead of
(< 0).

Change-Id: Ie16faf1da7df678fc8ab5af7ab33d7c0a2cdba7d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-18 20:27:09 +00:00
Johan Hedberg 72ce7c7dc1 Bluetooth: Add support for waiting for "NOP" Command Complete
Some controllers will emit an initial "NOP" Command Complete event
during initialization and expect the host to only send commands once
this event has been received. This patch adds a new Kconfig option to
be used in the case of such controllers and defaults this to true on
Arduino 101 with the H:4 driver where this behavior is currently
observed.

Change-Id: I440f14a7c07ac27545febf9f85ebcc343e2a4558
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-18 12:58:22 +00:00
Andrei Emeltchenko 2329d54546 arduino: Remove Kconfig warnings rearranging GPIO selection
Remove warnings below:
...
warning: (BLUETOOTH_NRF51_PM) selects GPIO which has unmet direct
dependencies (BOARD_GALILEO || BOARD_QUARK_SE_DEVBOARD &&
NETWORKING_WITH_15_4_TI_CC2520 || SOC_FSL_FRDM_K64F)
...

Change-Id: I15db8cf5f9895e0693e3363974e4cdad533b55a4
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-18 12:54:20 +00:00
Vlad Lungu c36daba63d spi: intel: fix port 1 pin setup
Currently, the /CS pin is deasserted by _spi_config_cs() and
the pinmux driver sets it as an input afterwards. Later, setting
the /CS pin to an output via pinmux_dev asserts it.

Setting the SPI port 1 pins in the pinmux driver saves a few lines
of code. Moving the SPI init after pinmux init keeps the /CS pin as
configured by the SPI driver.

Change-Id: I4c587ba0a6983cd89dfb5ecedb2914335e86313b
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-04-16 21:14:43 +00:00
Bogdan Davidoaia b53b27701a sensors: add driver for TMP007 infrared thermopile sensor
Add driver for the TMP007 intrared thermopile sensor which measures
the temperature of an object without direct contact.

Datasheet:
	http://www.ti.com/lit/ds/symlink/tmp007.pdf

Origin: Original
Change-Id: I29857b2e424a2144370d75e2ee40c4ff8b619afd
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-16 05:32:35 +00:00
Benjamin Walsh 0ff5d37a4a console: add hook for debug server to handle outgoing characters
A debug server might want to redirect outgoing characters on the console
to another output if it piggybacks on the serial line normally reserved
for the console.

Change-Id: I534f5b35456306940a3926f52fe5cce2d5c94da4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-04-16 05:29:20 +00:00
Anas Nashif 8980a92ca1 pinmux: include errno.h
Change-Id: I870a46aaa8d0cac0a35a1b8691607a2436daa68f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-16 02:02:11 +00:00
Anas Nashif 874877519e Bluetooth: include errno.h
Change-Id: I42e9e952780c4ffeba28a857b9a3836dcda5d7ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-16 02:02:11 +00:00
Baohong Liu d45eab2a7c drivers: Quark flash support
Quark flash sub-driver. It is based on the QMSI driver.

In order to enable this driver, the following options
must be set.

CONFIG_QMSI_DRIVERS
CONFIG_QMSI_INSTALL_PATH
CONFIG_FLASH
CONFIG_SOC_FLASH_QMSI

Origin: Original

Change-Id: Iffbea3b17624c755e367677b76d7216c2fba2ca1
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-04-16 02:01:25 +00:00
Daniel Leung a2ff6eaf1c grove/lcd_rgb: assign magic number to driver_api
Since device_get_binding() will not return any reference to
a driver instance if port->driver_api is NULL and grove_lcd
does not have any API struct, just populate it with some
magic number so grove_lcd can be referenced.

Change-Id: I16bdd13dfb49c54b5bdff34c4a4124af229aa20c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:07:34 +00:00
Daniel Leung 0c9876cc8d ipm: convert to use DEVICE_AND_API_INIT()
Change-Id: I2c81bc0d232473c76c0a4ffbf13faf4eabedda85
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:16 +00:00
Daniel Leung 36fe805057 serial/stellaris: convert to use DEVICE_AND_API_INIT()
Change-Id: I4da787515ef01d4ee72c6ad35478b460b9a7fb0d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:16 +00:00
Daniel Leung 46052f2ad8 watchdog/iwdg_stm32: convert to use DEVICE_AND_API_INIT()
Change-Id: Ie72eedbe17d4534751a8b459bd35939f57534011
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:15 +00:00
Daniel Leung 73be1230ee serial/uart_stm32: convert to use DEVICE_AND_API_INIT()
Change-Id: I82ba83453f14761c325b208fc56387411ab8ce40
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:15 +00:00
Daniel Leung 9e575ddbe6 gpio/stm32: convert to use DEVICE_AND_API_INIT()
Change-Id: I584c73e7418344e73af0ca7a4fc8f5d745e2ec35
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:15 +00:00
Daniel Leung 00dce01c89 clock_control/stm32f10x: convert to use DEVICE_AND_API_INIT()
Change-Id: Ifba0123c6843396341d213601889fa6839bfedd6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:14 +00:00
Daniel Leung 4dee91bea9 gpio/atmel_sam3: convert to use DEVICE_AND_API_INIT()
Change-Id: I09cd91737993d30c89073656b8ae95462d5f317d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:14 +00:00
Daniel Leung 8f9e38adc4 i2c/atmel_sam3: convert to use DEVICE_AND_API_INIT()
Change-Id: I810716d5eb99b7b8c0f06534877eccfc71d959eb
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:14 +00:00
Daniel Leung fbdc7945e3 uart/atmel_sam3: convert to use DEVICE_AND_API_INIT()
Change-Id: I55edf55b366f6516652a5c65b9efd5009564df90
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:14 +00:00
Daniel Leung 196b88f4d0 spi/k64: convert to use DEVICE_AND_API_INIT()
Change-Id: I6eda6fdcc735250f83c39b43973655582090401e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:13 +00:00
Daniel Leung c8bc070d72 pwm/k64_ftm: convert to use DEVICE_AND_API_INIT()
Change-Id: Ia9f7c31f62046970a77fabad61fcbbd64b91aea2
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:13 +00:00
Daniel Leung ecf4836d25 serial/k20: convert to use DEVICE_AND_API_INIT()
Change-Id: I4f895f58eb84740f11be5450f244217f7e1a4a22
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:13 +00:00
Daniel Leung 9b23654f68 gpio/k64: convert to use DEVICE_AND_API_INIT()
Change-Id: I7fa0aa8f23e6d3b6c0664e211d605a03ae7e150c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:12 +00:00
Daniel Leung aa0635aa30 watchdog/dw: convert to use DEVICE_AND_API_INIT()
Change-Id: Id345c74ca4b466838f0382ef686d70ff5aedb10e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:12 +00:00
Daniel Leung 6a8681a8d4 rtc/dw: convert to use DEVICE_AND_API_INIT()
Change-Id: I64b0a2d926813654318b289b2d8491deb107e94d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:12 +00:00
Daniel Leung 2898e249da spi/dw: convert to use DEVICE_AND_API_INIT()
Note that the failure case can only be reached when compiling
for ARC side of Quark SE. Otherwise, the code is never compiled
which reduces code size for other platforms.

Change-Id: Ic76890cbaf22da5c3563e056cba9b39615d3da0c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:11 +00:00
Daniel Leung 317922a3b6 pwm/dw: convert to use DEVICE_AND_API_INIT()
Change-Id: I31ee7b631293f1bd94085adec5979d113adf6026
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:11 +00:00
Daniel Leung 6bb186b754 adc/dw: convert to use DEVICE_AND_API_INIT()
Change-Id: Ieaf72ea553bff766314e69f1e58888c2ccc07f21
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:11 +00:00
Daniel Leung da782358aa i2c/quark_se_ss: convert to use DEVICE_AND_API_INIT()
Change-Id: Iefe73cf68355a02e78f328e5d13c354f6e1624c8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:10 +00:00
Daniel Leung 21727b5d86 i2c/dw: convert to use DEVICE_AND_API_INIT()
Note that the failure case can only be reached when PCI is enabled.
Otherwise, the if-block is always false, which reduces code size
for non-PCI platforms.

Change-Id: I71656468eaee702bc481f5fbd490677b7bc491c1
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:10 +00:00
Daniel Leung c21e93eeee gpio/dw: convert to use DEVICE_AND_API_INIT()
Note that the failure case can only be reached when PCI is enabled.
Otherwise, the if-block is always false, which reduces code size
for non-PCI platforms.

Change-Id: I1f9def66b2ce7f08fc13b8f03e675ce4cd469e6d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:10 +00:00
Daniel Leung 793da30039 serial/uart_ns16550: convert to use DEVICE_AND_API_INIT()
Note that the failure case can only be reached when PCI is enabled.
Otherwise, the if-block is always false, which reduces code size
for non-PCI platforms.

Change-Id: Ib98b78a75cc2a5f124e67f32f2bf82960a963aec
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:10 +00:00
Daniel Leung 0ac7c72e7b clock_control/quark_se: convert to use DEVICE_AND_API_INIT()
Change-Id: Ib3aa021b8e8c32079d5800b3f2ffc9f9fabdb4b6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:09 +00:00
Daniel Leung ab38abff12 pinmux/dev: convert to use DEVICE_AND_API_INIT()
This converts the pinmux/dev drivers to use DEVICE_AND_API_INIT(),
since the driver_api assignment will never change.

Change-Id: I0063b19e2afe932e1daf3255e718455aaa200ff1
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:09 +00:00
Andrei Emeltchenko 8418b2eeb3 drivers/nble: Implement read multiple response
Implement on_nble_gattc_read_multiple_rsp().

Change-Id: I25e8e7f74325024fde1737086e4674893f4a105a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-15 17:02:11 +00:00
Mariusz Skamra 1bc53f3f47 drivers/nble: Fix NULL pointer dereference
This fixes conn->gatt_private = NULL pointer dereference that occurs
in the next Read Blob Response, here:

/* TODO: Get params from user_data pointer, not working at the moment */
params = conn->gatt_private;

Change-Id: Icf280c856133a4c91fc10475d3a047809f917f46
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-15 11:04:20 +02:00
Szymon Janc c2a1ac8ae7 Bluetooth: Add support for confirming incoming JustWorks pairing
If incoming pairing request would result in JustWorks pairing this
can be used to request consent from user for accepting it.

Change-Id: If0695d0e1bb010bade6a16abe1b57a2ce07856cc
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-14 15:20:03 +00:00
Andrei Emeltchenko 931afc81a4 drivers/nble: Fix spelling typo
Change-Id: Ibe5c910a69fccdf4375738ec13cbea9d6c972a41
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-14 14:48:51 +00:00
Grzegorz Kolodziejczyk 2bae7b4c5f Bluetooth: drivers/nble: Fix returning included service handle
Parse include function intention is to return last parsed included
service handle. Next discovery iteration of included services should be
started from last found included service handle instead of end handle
from included handle value (which contains attribute handle of included
service declaration and the end group handle, BLUETOOTH SPECIFICATION
Version 4.2 [Vol 3, Part G], 4.5.1).

Change-Id: I73fe4027cb616242e838ea54c61b7780f1838e52
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-14 13:47:26 +00:00
Mariusz Skamra ff8b88b634 drivers/nble: Fix handling read errors
If on_nble_gattc_read_rsp returns an error, this error shall be
passed to the application to let know that Read Request/Read Blob Request
was aborted due to ATT error received.

Change-Id: I0efe26ec90fe27a1ab3c791e555ebe682927ab57
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-14 12:42:09 +02:00
Mariusz Skamra 5047d54403 drivers/nble: Fix compare logic in on_nble_gattc_read_rsp
The Read Response only contains a Characteristic Value that is less
than or equal to (ATT_MTU – 1) octets in length so, condition
(length < bt_att_get_mtu(conn)) is always true, and the full
Characteristic Value will not be read.

Change-Id: Ib18fbedf277c880dc5cf0ce21fd7d550d12a64ef
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-14 12:41:39 +02:00
Tomasz Bursztyka c239a8cb7b cc2520: Properly start and stop the device
Disable reception and the oscillator as well when stopping. Revert
when starting.

Change-Id: I2a61066602267ac61e691ec9c20eb243de6fa076
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-14 07:49:23 +00:00
Tomasz Bursztyka d8dcf56334 cc2520: Enable hardware filtering all the time
This prevents false packets to get accepted/generated into RX fifo.
Also, this will make AUTOACK working properly, when enabled. For some
reasons FRMFILT1 and SRCMATCH need to get their reset values written at
initialization, or then hw filtering won't work. This behavior is not
documented as it seems.

Change-Id: Ic0fe664dbc3b17d85d794c12b77bdbaafeb601f5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-14 07:49:23 +00:00
Tomasz Bursztyka a9af3c0512 cc2520: Set short address and ieee address from the driver
For hw filtering and autoack to work, all the information should be
properly set in the chip.

That's a fix for the legacy radio/net API. From original code, these
were set from the application which is bad. But setting it from the
driver is not any better. ieee802154 and net stack should know what to
do, that will be fixed in the future.

Change-Id: I1688223e9488d10a423e788eb88ba1e251cb3f88
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-14 07:49:23 +00:00
Bogdan Davidoaia 176c2525a6 sensors: bma280: fix slope threshold measurement unit
Slope threshold attribute values should be received in m/s^2 instead
of Gs, since accel channels return data in m/s^2.

Change-Id: I0669345ff8af8559e47895bca8225e15d2576a06
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-13 17:27:08 +00:00
Bogdan Davidoaia 69793bb320 sensors: use SENSOR_G constant in all accelerometer drivers
Use the SENSOR_G constant from sensor.h in all accelerometer
drivers, instead of having the constant redefined in each
driver header file.

Since GRAVITY_CONST was measured in mili-m/s^2 and SENSOR_G
is measured in micro-m/s^2, some changes to the calculation
of the acceleration data were added.

Change-Id: Ia323dfc46bee00035e24b37e1b7fbc886dfbe029
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-13 17:27:08 +00:00
Daniel Leung 756b90b01f flash/spi_flash_w25qxxdv: do not set driver_api if init fails
If the driver fails initializations, do not set the driver_api.
This follows the idea that device_get_binding() will not return
a reference to the driver instance when driver init fails.

Change-Id: Iff56b4150658a76567928b1fd166bde5d2848d52
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 23:52:10 +00:00
Jukka Rissanen 12485eb8c9 cc2520: Make the generated MAC address to look more random
Because the random number generator is very dumb at the moment,
the generated MAC address has always last byte set to 0.
The MAC address is used when generating IPv6 address.
In order to avoid IPv6 address collision, swap the last four
bytes of the MAC address so that the most random data is
at the end of the MAC.

Change-Id: I96c03654359e32f407bab3b29be0e3b08ee91bd7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-04-12 16:27:21 +03:00
Daniel Leung 90e93dce05 spi/intel: move driver_api assignment later
This moves the assignment of driver_api to just before
the init function returns. This is in preparation to
make device_get_binding() return NULL if driver
initialization fails.

Change-Id: I69590c463b84877d250c63d4460b7e254b79c8b3
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
Daniel Leung 1870f95364 uart/nsim: fixed missing driver_api assignment
Change-Id: Icbda7600b808fa0338e4d672ccca1b969b6f5867
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
Daniel Leung b8e887a112 gpio/pcal_9535a: move driver_api assignment later
This moves the assignment of driver_api to just before
the init function returns. This is in preparation to
make device_get_binding() return NULL if driver
initialization fails.

Change-Id: Ibf08cb107885da7c1037c6e7d207530e1a4708f8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
Daniel Leung aa98192cad pwm/pca_9685: move driver_api assignment later
This moves the assignment of driver_api to just before
the init function returns. This is in preparation to
make device_get_binding() return NULL if driver
initialization fails.

Change-Id: Ia0c7a0014eb28624cbf363f994d6149f1aa5aadd
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 11:25:03 +00:00
Johan Hedberg bacdf02061 Bluetooth: drivers/nble: Fix minor coding style issue
Change-Id: I71caf45702f053033fde5c5c0bc4dea22dbe95d1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-12 12:33:24 +03:00
Andrei Emeltchenko e12cf24e6d drivers/nble: Implement multiple read in bt_gatt_read
Implement read multiple characteristics in bt_gatt_read().

Change-Id: I18c11275e4352bfc571b06558116bcbb9b4a32d3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-12 12:09:08 +03:00
Andrei Emeltchenko 424cf4f9d2 drivers/nble: Update RPC to Nordic BLE Module
Add read multiple attributes request and response. Update RPC version
to niko-0412.

Change-Id: I5dfd99a1b8af866b69eae230ad24304eafccab4d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-12 10:32:41 +03:00
Andrei Emeltchenko 37ef89511d drivers/nble: Correct auth configuration for No Input / Output
Change-Id: I5d1a9508ca8deca97149db2faa2f3406517e3b05
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-11 15:24:24 +00:00
Johan Hedberg 30601c09bb Bluetooth: Refactor buffer handling for non-host managed buffers
So far the assumption has been that the host stack manages all
incoming and outgoing buffers. For the incoming buffers (from the
controller) this has required hci_core.c to manage its own pools and
do the host flow control. This setup makes perfect sense for an
architecture where the controller resides remotely on a different CPU
& address space (i.e. the "traditional" HCI transport case).

When the stack runs on a system where the controller resides in the
same address space this setup doesn't work that well. In such a
scenario the incoming buffers are ideally created as low down in the
stack as possible (i.e. below HCI), which means that the current
hci_core.c cannot be responsible for managing their pools.

To allow for both types of architectures this patch introduces a new
BLUETOOTH_HOST_BUFFERS Kconfig option that can be selected to say that
host-side management is desired, or deselected to say that the
controller (residing in the same address space) takes care of managing
the incoming buffers.

So far the incoming buffer types were identified by hci_core.c by
looking at their "free pool" pointers, however as soon as the pools
are allowed to be somewhere else this doesn't work. To solve this we
now require a minimum user data size for all Bluetooth buffers and use
that to store the buffer type.

Change-Id: I14bc32007e3e3f17c654f71f79b520650028d7ce
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-11 11:52:29 +00:00
Vlad Dogaru 9e563c8769 gpio: dw: add support for D2000 board
The D2000 CRB is similar to the Arduino 101 (at least as GPIO is
concerned).  Add support for using the GPIO controller without QMSI
libraries.

Change-Id: I001da05c9a9d5771b2ec678a9d4a91c44db05289
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-04-08 17:55:44 +00:00
Johan Hedberg 9d90ef45ec Bluetooth: drivers/nble: Add Kconfig option for conn.c
Without this conn.c will cause logs whenever BLUETOOTH_DEBUG is
enabled.

Change-Id: I03f7d6b5b37e05ca23cba20536b24dbdb850304d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-08 13:27:33 +00:00
Johan Hedberg 8e4582f80d Bluetooth: Kconfig: don't hardcode "UART_0"
Change-Id: Ic1da719450d3ba516d61c67a3256b38e04f7585c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-08 13:27:20 +00:00
Johan Hedberg e5df34041f Bluetooth: Refactor nRF51 API
The previous enable/disable API implementations weren't actually what
their names implied, but simply gave the right result for the
initialization scenario when called after each other. Split these into
proper init/enable/disable APIs which do the exact thing that the
names imply.

Change-Id: I09a930d3607f4919ecd889ec3ee4ba8d7b12ee36
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-08 13:27:02 +00:00
Tomasz Bursztyka a1adbcb125 ieee802154: Replace the CC2520 driver with a new implementation
This is a complete new cc2520 driver for zephyr. Intention is to fit
better within Zephyr device driver model.

- It's (almost*) ready to be instanciated as many times as necessary
- It's fully interrupt based on SFD and FIFOP (no pin polling)
- It's nicer to other sub-systems (it sleeps, no busy-wait loop)
- It still loosely complies to old legacy radio device driver model

*: GPIO API needs to be fixed in order to accept multiple callbacks, as
well as enabling callbacks to retrieve private data.

Notes:
- Hardware filtering does not work yet as the net stack, above, needs to
  provide the relevant information for it (src/dst ieee802154 extended
  addresses, short addresses...)
- A embryo of generic functions (txpower, channel, addresses...)
  have been implemented but don't belong yet to any radio device driver
  model. Such new driver model will come afterwards (soon?)
- SPI API would need to be improved to avoid as much as possible memcpy
  as well as spi_slave_select() call.

Change-Id: I1fd6dfff28fba3984f6006d394ea12f1e763ac18
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-07 17:25:02 +00:00
Tomasz Bursztyka f7d5d2c8f5 drivers: Renaming directory "802.15.4" into "ieee802154"
ieee802154 is a more relevant name. Applying the change in
include/drivers as well.

Change-Id: I7f7188ed0421045d7667303c375eeb8af1298b97
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-07 17:24:55 +00:00
Murtaza Alexandru fbd45861f3 sensor: lsm9ds0-gyro: fix FULL_SCALE attribute
SENSOR_ATTR_FULL_SCALE attribute now expects the value as radians per
second.

Change-Id: I8082a1f112f1ed8efb511de39e3a8e5ae3d3ed0c
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-04-07 17:00:09 +00:00
Johan Hedberg 7f07d28f37 Bluetooth: Fix BLUETOOTH_NRF51_PM Kconfig definition
Clarify the name of the option and add a dependency to Arduino 101
which is the only known board that is currently known to need it.

Change-Id: Ibfb96cba202f34464b45b922da599da70c038d12
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-07 10:50:52 +03:00
Bogdan Davidoaia 3bdf498716 sensors: fix coding style regarding max line length
Fix coding style so line length does not exceed 80 chars.

Change-Id: Iddebdf55593736cfa288a03a750cc927665f9065
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-07 01:03:40 +00:00
Daniel Leung ba4099430b ethernet/dw: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and
should not be configurable via kconfig.

Change-Id: Ib483419be5199b52cf281b4b106cd8a3be95b7be
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-07 00:58:57 +00:00
Sergio Rodriguez 1b41169828 rtc/qmsi: Fix the IRQ priority setting according to the SoC specific option
The configuration option CONFIG_RTC_IRQ_PRI does not longer exist, and have
to use the specific QMSI driver IRQ priority

Change-Id: I8074c6d8e095596d03e51a94f26a73c3a9ff91b7
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-04-06 12:05:23 -07:00
Grzegorz Kolodziejczyk 355ded1863 drivers/nble: Add support to bt_gatt_attr_next
This function is needed to get next attribute of  passed to function
attribute.

Change-Id: Iefe2015f2d6bcb650012b1f9d5b1ea98e8fa8f48
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-06 12:35:49 +00:00
Andrei Emeltchenko bd5f745e25 Bluetooth: Enable Nordic BLE chip using PM helpers
When Nordic BLE chip is flashed with HCI firmware use H:4 UART driver
and enable chip the same way we enable for NBLE.

Change-Id: Ie14734266803088feadb0d0eb20c49c3615f0267
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-06 12:10:21 +00:00
Johan Hedberg f72063e214 Bluetooth: drivers/nble: Require callback for bt_enable()
The nble nRF51 firmware cannot handle situations where it receives
data before it is ready. The RPC calls otoh cannot be blocking.
Combine this with the fact that bt_enable(NULL) is supposed to be
blocking means we cannot support this mode of operation with nble.

Change-Id: Ib9c2c322b44b04bc48be243c2ba1c1bc4becb8ea
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-06 11:51:27 +00:00
Andrei Emeltchenko 3252f6cf1a drivers/nble: Refactor PM code to make it reusable
Refactoring Power Management related code to special file nrf51_pm
making it possible to reuse the functions for H:4 UART driver when
Nordic BLE is flashed with HCI firmware.

Change-Id: If389c1f4af13fa786e5866129624527cec0928e0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-06 14:00:56 +03:00
Andrei Emeltchenko 8e4440674e Bluetooth: Add option for PM with Nordic BLE chip
The config option handles enabling, disabling and power management
operations with Nordic nRF51 BLE chip.

Change-Id: I816062a7fb17c9e57c234113a2cecdebceb407b6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-06 14:00:55 +03:00
Andrei Emeltchenko ecc35267da drivers/nble: Move Nordic Bluetooth LE driver inside drivers/bluetooth
Move NBLE code to the place where other Bluetooth drivers code resides.

Change-Id: Ibcf9ffb016e9b842bed66a61dff5c101b1573aaa
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-05 14:04:44 +03:00
Johan Hedberg bc706e2a88 Bluetooth: Add stub for bt_storage_clear()
Change-Id: I7ab9ee4ca1d9702e7aef23aadfa627554907d145
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-05 12:29:14 +03:00
Johan Hedberg d0e4e0183e Bluetooth: Rename bt_register_storage to bt_storage_register
Keep a single bt_storage_* name space for current and future storage
APIs.

Change-Id: If158eb7408cce7c06cd8f98d78a061b9f9585265
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-05 12:29:14 +03:00
Andrei Emeltchenko 24732e8fb9 drivers/nble: Fix typo in compatible_firmware name
Change-Id: I81a211892e61bc11db5e5e8c1715f7971d64ace1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-05 11:18:53 +03:00
Andrei Emeltchenko 8f5e21154b drivers/nble: Update RPC to Nordic firmware 0404 version
Update RPC headers and change compatible_firmware version 0404.

Change-Id: Ie9920d302f3787c07181bc6aa519a96556463a79
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-05 11:18:53 +03:00
Andrei Emeltchenko f0f91d4a7b drivers/nble: Refactor Nordic BLE chip enable functions
Move NBLE pin handling to the driver from gap.c.

Change-Id: I4b7fd408c623971d19da12784c656c5c605852a5
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-05 11:18:53 +03:00
Andrei Emeltchenko 777a76297d drivers/nble: Implement GATT read Characteristic Presentation Format
Implement bt_gatt_attr_read_cpf() for NBLE.

Change-Id: Ia99db05a3f67bef3c1617df37fd371a8b1e8beb6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-04 14:34:18 +00:00
Johan Hedberg 7e7eee0fb4 Bluetooth: Add skeleton for persistent storage API
Add initial skeleton for the persistent storage API.

Change-Id: I7a6cc283aa88e7d861af18a6f0db2ed8c71e44a0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-04 14:01:59 +03:00
Daniel Leung 8425568a8a gpio/dw: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and
should not be configurable via kconfig.

Change-Id: Ib7e0b81b2df1a0225fc244fea3035416d0a4f282
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-02 23:11:07 +00:00
Laurentiu Palcu 7dd2372dd5 spi_dw: use SPI bus frequency in spi_dw_configure()
The SPI API states:

"max_sys_freq is the maximum frequency supported by the slave it
will deal with"

However, currently, for DW the max_sys_freq is a divider which confuses
the user.

This patch adds a small hack to allow users to use both dividers and
frequencies when configuring the bus. The only trade-off is one has to
use dividers for bus frequencies smaller than 65536Hz. However, since
most devices nowadays can run at clock frequencies more than 100kHz,
this is a good compromise.

Change-Id: I44386cc8ad501b08eeaf71bc7588661ff36e108b
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-02 23:08:49 +00:00
Laurentiu Palcu 5d2a200381 sensor: add driver for BMI160
This patch adds support for the Curie's BMI160 IMU chip. Only polling is
supported in this version.

Datasheet:
http://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMI160-DS000-07.pdf

Origin: Original
Change-Id: I759856d4bf123c21e9e4928f32bdf8f00aeeed24
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-02 23:08:48 +00:00
Daniel Leung 7328eb0d9e pinmux/galileo: include board.h
Or else, PINMUX_NUM_PINS is not found.

Change-Id: I48c173395f2cda72e8915c46aad964e83509a605
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-01 09:52:04 -07:00
Maciek Borzecki 5eb51feeb0 console: shell: expect const commands array
The commands array is not expected to change and can be declared
const. This allows callers to cleanly declare their commands lists as
const, effectively moving the structures from SRAM to code section.

Change-Id: Ie1710622b8cfa609e129eb79712f910f1d1aace3
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-04-01 13:12:56 +00:00
Vlad Dogaru 320651281c sensor: bmp280: fix pressure value
The comments in the sensor header specify that pressure should be
expressed in kPa, but the bmp280 driver returns a value in Pa.

Change-Id: I6d5346db250d1a01a1e5e31fb1d8685ab5dc405b
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-04-01 14:48:00 +03:00
liu.lei acd673eb1b pinmux: Fix where to look for PINMUX_BASE_ADDR
Fixes this built error:
zephyr/drivers/pinmux/dev/pinmux_dev_quark_mcu.c:138:18:
error: 'PINMUX_BASE_ADDR' undeclared here (not in a function)
.base_address = PINMUX_BASE_ADDR,

Change-Id: I54f15bc262cb887117f7b56660bcf85983daa877
Signed-off-by: liu.lei <lei.a.liu@intel.com>
2016-04-01 10:38:44 +00:00
Andrei Emeltchenko 0d446131d2 drivers/nble: Implement read CUD attribute
Implement bt_gatt_attr_read_cud() making working peripheral_esp app.

Change-Id: Ic9634bf31a39ae9cd55279de34ee4c0c0995a4dd
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-01 10:46:39 +03:00
Sebastien Griffoul 4b70134d1a eth_dw: fix buffer leak when RX frames are too large
When an ethernet frame is larger than UIP_BUFSIZE,
a net_buf is allocated but never released. Therefore
after few bad frames, no more RX network packet
can be received.

Fixed by allocating the net_buf after checking
the frame length.

Change-Id: I436487e3c26d739de347b4db6facc3a3dbebbe75
Signed-off-by: Sebastien Griffoul <sebastien.griffoul@intel.com>
2016-03-31 23:18:17 +00:00
Daniel Leung 8a05b46325 rtc/dw: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and
should not be configurable via kconfig.

This also separates IRQ_PRI into one for DW and one
for QMSI, to follow the convention of every other
drivers.

Change-Id: I338f819f71c18fa9e17015e8a588a3d0207350c6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-31 23:17:25 +00:00
Daniel Leung f1ead35cc6 watchdog/wdt_dw: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and
should not be configurable via kconfig.

Change-Id: Ic73783189db57059d2b7f3727e4802e1b2e27931
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-31 23:17:24 +00:00
Daniel Leung 2d1ed03a8f pwm/k64_ftm: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and
should not be configurable via kconfig.

Change-Id: Ifd65097a65f80539cac073f95aadc2d8e42efb9f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-31 23:17:24 +00:00
Daniel Leung 17b3a85308 pwm/dw: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and
should not be configurable via kconfig.

Change-Id: Ifdbb5e3a997795ef577350d88f8cb06877eb6463
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-31 23:17:24 +00:00
Daniel Leung 5e886b2748 gpio/sch: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and
should not be configurable via kconfig.

Change-Id: Ib8158f00a6c6616360ddbcf63981f1a85911c1b9
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-31 23:17:23 +00:00
Andre Guedes 6e71586c37 i2c: qmsi: Add support for default configuration
This patch extends the i2c shim driver so it supports the 'default
configuration' infrastructure which enables the user to specify a
default configuration for the I2C device. The default configuration
is set during driver initialization.

This patch also changes Quark SE and D2000 Kconfig.defconfig files so
the i2c default configuration is set to '0x12' which means standard
bus speed, 7-bit addressing and master mode. This is the same value
used when DW driver is selected, by the way.

Change-Id: I06e0dc3c29e8da2f3317db5bef285177f2e92c9a
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-31 13:18:26 +00:00
Daniel Leung cb83db8c74 i2c/dw: remove kconfigs that are SoC specific
Remove those kconfig options that are SoC specific, and should not be
configurable via kconfig.

Change-Id: Ia62888838877da4627419bd36c261d5254761acd
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-31 01:11:23 +00:00
Andre Guedes 3c01cc6cff i2c: Remove redundancy in Kconfig.qmsi
Each option within Kconfig.qmsi already set its dependency so this
patch removes the 'if I2C_QMSI' block since it is redundant.

Change-Id: Ic221b96766ecac685491cb31525caf28e641ee45
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-30 20:03:02 +00:00
Tomasz Bursztyka 1de33f4d5f gpio: dw: ISR handler should acknowlegde only current interrupts
Current interrupt status tells which pins triggered this interrupt, thus
the handler should acknowledge only these and not all possible, since we
don't know if other gpio controller interrupts are being taken care of
at the same moment.

Change-Id: I7d3f1bb13bb293f7b7ce9b5a717a37bbdd4e4e42
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-03-30 16:19:39 +00:00
Daniel Leung e539888614 i2c: remove orphan kconfig I2C_STATUS_DELAY
No one is using it so remove it.

Change-Id: I79f19a7a9a784465d68a0fe85fe9f815279a240d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-30 13:39:09 +00:00
Daniel Leung 8563a5178d aio_comparator/dw: base address to be defined by SoC
This is hardware design so there is no need for it to be
configurable in kconfig.

Change-Id: Iff162f330aae8ef9a7139b6e7ed9bfa87f26189a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-30 13:39:04 +00:00
Daniel Leung 8f6068e9d8 serial/ns16550: make IRQ triggering condition a SoC decision
The IRQ triggering condition should be specified by SoC as it is
a decision for hardware design. This should not be configurable
in kconfig.

The default is to be triggered on rising edge, just as the same
old kconfig did.

Change-Id: If59d88a30711eb8e03d9cc4f409055cefe1995c5
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-30 13:38:34 +00:00
Daniel Leung 26b474c987 serial/ns16550: reduce number of kconfig options
Moves those kconfig options which should be declared in
SoC or board header files instead. These are the one
that are tied to SoC or board and there is no need
for them to be configurable in kconfig.

Change-Id: I243d634f1a4a11dc8dc3530d95f93371015492b7
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-30 13:38:34 +00:00
Mariusz Skamra 4800266cc6 drivers/console: Fix flush data on uart_pipe_setup
This patch fixes drain of data left in UART Rx fifo.
uart_irq_tx_ready checks if Rx IRQ has been raised,
but because Rx IRQ is disabled this won't work even
if there are some data left in the UART buffers.
So simply uart_fifo_read is used to discard the data that
left in UART buffer.

Change-Id: I17f145ba58640650bafd3602412fc75229f39664
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-29 16:41:50 +00:00
Andre Guedes 114e5ba186 pwm: Remove redundancy in Kconfig.qmsi
The PWM_QMSI_DEV_NAME and PWM_QMSI_NUM_PORTS options depend on PWM_QMSI
already so this patch removes the 'if PWM_QMSI' block since it is
redundant.

Change-Id: Iec303d27f088b96662fc58933eaa82fe9459cb59
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-29 11:05:23 +00:00
Tomasz Bursztyka 666e99b41b pinmux: Fix where to look for PINMUX_BASE_ADDR
Fixes this built error:
zephyr/drivers/pinmux/quark_mcu/pinmux_board_quark_se_dev.c:149:19:
error: 'PINMUX_BASE_ADDR' undeclared (first use in this function)
  _pinmux_defaults(PINMUX_BASE_ADDR);

Change-Id: I8302e4d6dbcf961e0c80f6bccf740a877bb364af
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-03-29 13:07:55 +02:00
Anas Nashif 9f76f7d1f7 kconfig: use menuconfig for PCI options
Change-Id: Ie1ccefc91ca0174dfea874bbda4723e6b49c7880
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-29 01:31:52 +00:00
Daniel Leung c65821718f i2c/quark_se_ss: Remove base address kconfig options
The base addresses are SoC specific so there is no need to make
configurable via kconfig.

Change-Id: Iaf8444f77513255d5f0112af6710243aae09f066
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-28 16:09:15 -07:00
Daniel Leung 3f408ee20a i2c/qmsi: rename *_INT_PRIORITY to *_IRQ_PRI
This is to standardize the kconfig for specifying IRQ priority.

Change-Id: Iab10655c6fc6f17c0c6dd49cb7a4e74fabcf852c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-28 15:59:04 -07:00
Daniel Leung 36678521c3 i2c/dw: rename *_INT_PRIORITY to *_IRQ_PRI
This is to standardize the kconfig for specifying IRQ priority.

Change-Id: I3a51b35e633dc7b1b841e9fa504bf0cfc0d4d575
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-28 15:59:04 -07:00
Daniel Leung ee216548e6 i2c/atmel_sam3: rename *_INT_PRIORITY to *_IRQ_PRI
This is to standardize the kconfig for specifying IRQ priority.

Change-Id: I05ae4033e2c5431ba2727c5d4000ef07e14739c8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-28 15:59:04 -07:00
Daniel Leung 546b8ade37 refactor common driver initialization priorities
Most of the SoC and board Kconfig use the same values for
driver initialization priorities. So refactor them, and
discard duplicate ones.

The shared IRQ init priority was changed so that the kernel
default init and device init priorities can be standardized
across all SoC/boards. Same goes for DesignWare SPI driver.

This also changes the UART_CONSOLE_PRIORITY and
IPM_CONSOLE_PRIORITY to UART_CONSOLE_INIT_PRIORITY and
IPM_CONSOLE_INIT_PRIORITY, to standardize across all drivers.

Note that this does not take away the ability to override
those values. This just provides reasonable defaults such
that there is virtually no need to override.

Change-Id: Ibbd95d802c637df06f9a2fd48763ee1e6f4ff627
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-28 15:58:29 -07:00
Daniel Leung cecc4b0fb5 pinmux: remove base address and number of pins from kconfig
The pinmux base address and number of pins are now defined in SoC or board
header files instead of specifying them in kconfig. This is because
the pinmux ties directly to the SoC (or board expanders) so the base
address and number of pins do not need to be configurable in kconfig.

Change-Id: Ib6090d7d022b491f3fe8f522858281504c6302bb
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-28 15:58:29 -07:00
Daniel Leung d7f45b8634 pinmux/galileo: extract kconfig options into its own file
This is to follow how kconfig are defined for other SoC/boards.

Origin: refactored from exising file
Change-Id: Ic83b8a336f1910f17b3cf4e7f029fd076ba1b6bb
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-28 15:58:29 -07:00
Daniel Leung a2ba5d1ba3 spi/k64: remove SoC specific SPI constants from kconfig
The base address, IRQ line, chip select numbers, and clock
gating constants are static per SoC, so there is no need to
make them configurable in Kconfig.

Change-Id: I9f87ca29c28c38c42d4e4f1a3a41fa231f63ef03
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-26 20:36:32 -04:00
Daniel Leung 9c62a4a01f frdm_k64f: gpio: pinmux: remove base addr and irq from kconfig
The base address and IRQ line are static per SoC, so there is no need
to make them configurable in Kconfig.

Change-Id: Ib78401ff136c29642356f5bda9d6cd3e5c98bece
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-26 20:36:32 -04:00
Daniel Leung 7f6d4e37ee serial/stellaris: remove base addr, irq and clk freq from kconfig
The UART port base address, IRQ line and clock frequency are static
per SoC, so there is no need to make them configurable in Kconfig.

Change-Id: Ia252958d205e0100d1b92e2a12d4c22411bc94b9
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-26 20:36:32 -04:00
Daniel Leung 2a29e22c2f serial/k20: remove base addr, irq and clk freq from kconfig
The UART port base address, IRQ line and clock frequency are static
per SoC, so there is no need to make them configurable in Kconfig.

Change-Id: I79b142414143bc5ef585d3136a00375233de1723
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-26 20:36:32 -04:00
Daniel Leung 8df10d4584 kconfig: untangle ordering and dependencies
There are two major issues with the kconfig:

() Some of the config options have incorrect dependencies inside help
   under menuconfig. For example, CONFIG_GPIO depends on BOARD_GALILEO.

() Since the SoC and board specific kconfig files are parsed first,
   the help screen would say, for example, CONFIG_SPI is defined at
   arch/arm/soc/fsl_frdm_k64f/Kconfig. This is incorrect because
   the actual config is defined in drivers/spi/Kconfig.

These cause great confusion to users of menuconfig/xconfig.

To fix these, the SoC and board defaults are now to be parsed last.

Note that the position swapping of defaults in this patch is due to
the fact the the default parsed last will be used.

And, spi_test is broken due to the fact that it requires
CONFIG_SPI_INTEL_PORT_1, but never enables it anywhere. This is
bypassed for now.

Origin: refactored and edited from existing files
Change-Id: I2a4b1ae5be4d27e68c960aa47d91ef350f2d500f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-26 20:36:32 -04:00
Vlad Dogaru 0e702a6ce3 sensor: add driver for BMP280
This is a temperature and atmospheric pressure chip.  The datasheet is
available at:
	https://www.adafruit.com/datasheets/BST-BMP280-DS001-11.pdf

Change-Id: I3406eb6c2c4da564757b8315323d0681d648b541
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-27 00:34:38 +00:00
Bogdan Davidoaia a302451cc4 sensor: add driver for LIS3DH accelerometer
Add device driver for the LIS3DH I2C-based triaxial accelerometer
sensor, which supports reading data from the accel-x, accel-y and
accel-z channels.

Datasheet:
	http://www.st.com/web/en/resource/technical/document/datasheet/CD00274221.pdf

Application note:
	http://www.st.com/web/en/resource/technical/document/application_note/CD00290365.pdf

Change-Id: Ib51bd6346798249d850376e50d1c938eda8a3d28
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-27 00:34:30 +00:00
Ramesh Thomas 4104bbfb08 power_mgmt: Add device power management support
Added device power management hook infrastructure. Added
DEVICE_INIT_PM and SYS_INIT_PM macros that creates device
structures with the supplied device_ops structure containing
the hooks.

Added example support in gpio_dw driver.  Updated the sample
app and tested using LPS and Device Suspend Only policies.

Change-Id: I2fe347f8d8fd1041d8318e02738990deb8c5d68e
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-26 14:35:11 -04:00
Ramesh Thomas bb19e6f82f power_mgmt: Make names consistent with new RFC
Changed names of Kconfig flags, variables, functions, files and
return codes consistent with names used in the RFC. Updated
relevant comments to match the changes.

Origin: Original
Change-Id: Ie7941032d7ad7af61fc02928f74538745e7966e8
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-26 14:35:11 -04:00
Dmitriy Korovkin 661d2f3a16 microkernel: Add support for *_sleep() during initialization
Add support for task_sleep() and fiber_sleep() during the
system initialization. When CONFIG_NANO_TIMEOUTS defined,
before the k_server() starts, kernel uses nanokernel
system clock announce and task sleep functionality.

To give device drivers early sleep functionality, the system
clock has to start on SECONDARY initialization level, same
as most of the drivers.

Change-Id: Ie1d391945cd1cfb9a5dc199783c2d224eb1b0ef3
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-03-26 10:17:15 +00:00
Maciek Borzecki f8c24fb203 gpio/stm32: fix build
Build with GPIO port E failed due to a missing comma.

Change-Id: Ib8fa7f4d03ed4f4c713a3a8a16ad3b37fcf6b0b7
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-25 23:31:36 +00:00
Vinicius Costa Gomes 1331deb2db pinmux_dev: Adds the STM32 pinmux dev driver
This driver will be used when changing pinmux functionality during
runtime.

Change-Id: I8dc7b36af13202b97183c5ee05932567e7396276
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes d872bb173c pinmux: Move STM32 boards to the pinmux model
This moves the STM32 based boards (Nucleo F103RB and STM32 Mini A15) to
the "new" pinmux model.

Change-Id: I190df271a6b83fafeec0b281cd4ee7cf13d7e7db
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes 56bebf9206 pinmux_dev: Add driver using QMSI library
Change-Id: I81e3b60ac6c4d57e1978a64fdeb651ae52b23b77
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes da28760014 pinmux_dev: Add Quark MCU generic driver
This driver can be used for multiple boards based on the Quark
microcontroller family, the exceptions are Quark X1000 and Quark D1000.

Change-Id: I4c6624293515e4bbf31ac94a7f57905b4a9ef13d
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes 95b4be9461 pinmux_dev: Add driver for Galileo board
Change-Id: I27d3ffc6dca56fa8704a269fee64b51ad1d18f1e
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes 3a9a77e77c pinmux_dev: Add driver for Freescale FRDM K64F
Change-Id: I89fcb707f70e385354f099d27895ac8b30bbdb03
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes 05cbf0b20b pinmux_dev: Add the pinmux_dev driver for Atmel SAM3X
This introduces the pinmux_dev driver for the Atmel SAM3X.

This driver implements what used to be the pinmux driver API, which
applications could use to modify the function of pins during runtime.

That functionality is now protected under the CONFIG_PINMUX_DEV option,
which should only be set during the early enabling of a new board, as
there is risk of damage to the board when misused.

Change-Id: I3aa00505d2771b53c41fe687c3e5230e804756be
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes 03f920e50d pinmux: Move the Quark SE devboard to the pinmux model
Change-Id: I4d10956a15c49f439b04163b1e25b33854214e21
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes 3f24658f29 pinmux: Move the Quark D2000 board to the pinmux model
Change-Id: If82e7323ffa8547bb6b090872948b5e69715b19b
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes a12a25ad00 pinmux: Move the Freescale FRDM K64F board to the pinmux model
Change-Id: I50cf5fcf00481a3ebac07ced3aa6f7783765934f
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes 41529e20e6 pinmux: Move the Galileo board to the pinmux model
Change-Id: Ib58b1ea56d6c82c2e055bf4cb0df4b07b0dd936e
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 06:17:33 -04:00
Vinicius Costa Gomes 649253c8a8 k64f: Fix mixing GPIO and pinmux concepts
Setting the direction of a GPIO pin is not the responsibility of the
pinmux "board" initialisation. This should be left for the GPIO
utilising application.

Some macros that were only used when setting the pin direction are
removed.

Change-Id: I5b63d52446a27fe539c89f0639a8dcadf5ea9f80
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 10:17:01 +00:00
Vinicius Costa Gomes f25c5ca061 pinmux: Move the Arduino Due board to the pinmux model
Change-Id: I53fb54c0d11bcdbc42191dd4a26787d9beebbf58
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 10:17:01 +00:00
Vinicius Costa Gomes ed6fc400e9 pinmux: Move the Arduino 101 board to the pinmux model
This driver doesn't provide any API, it only initializes the pinmux
controller to appropriate values depending on the board.

The first board to use this new infrastructure is the Arduino 101 board,
because it is alphabetically the first.

To better organize code for the different SoCs and boards, a "family"
level is created in the 'drivers/pinmux' directory. The Arduino 101
board is part of the Quark MCU "family".

The PINMUX_DEV configuration (and functionality) is removed for now, it
will be added back when the pinmux_dev drivers are (re)introduced, with
clearer semantics.

Change-Id: Idf5cc3caf6be620aa50828ae8fdc535df6caf458
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-25 10:17:00 +00:00
Simon Desfarges 9abc29e3ae arc_timer: assert that counter always lower than limit
ASSERT are put each time the timer0 limit register or the timer0 count register
is modified.

Change-Id: I38684d57803de285f4e26c68b449c71396e4c750
Signed-off-by: Simon Desfarges <simon.desfarges@intel.com>
2016-03-24 12:05:37 +00:00
Murtaza Alexandru b1ea13413e sensor: add driver for LSM9DS0 gyroscope
Add device driver for the gyroscope part of LSM9DS0 gyroscope.

Datasheet:
  https://www.adafruit.com/datasheets/LSM9DS0.pdf

Change-Id: I25e0c8470c9b68c594bc4a0d2a9a13f8f41ee309
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-03-24 08:03:31 +00:00
Tomasz Bursztyka 67196bc0c3 drivers: gpio: Align the style all over the drivers
Fixing:
- indentation
- 80 chars limit
- { } mandatory on relevant statements
- using BIT() macro relevantly

Change-Id: Ib84eb29530b175c8a533c1b361aea2632f0d7917
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-03-24 08:01:52 +00:00
Simon Desfarges a51f88638e arc_timer: fix tickless idle
When exiting from tickless idle uppon an external IRQ, the TICK timer
is set to fire at next TICK boundary. The current algorithm can lead
to a point that timer0_count register is higher than the timer0_limit
register.

In this situation the next TICK will fire after the counter has
wrapped and performed another cycle (~133 seconds).

This condition appears when the counter reaches the limit after the
Interrupt Pending flag is checked. At this point the counter is
automatically wrapped to 0, but is set just next to the limit to fire
at next TICK boundary by SW. At exit of the _timer_idle_exit function,
the timer handler is called, and sets the limit to 1 TICK. At this
point the situation is:
- limit register == 1 TICK
- count register is just below the old limit register and higher than
  1 TICK

To fix this issue, at _timer_idle_exit, the limit register is always
set to 1 TICK and the count register set such as the next TICK fires
on time.

Change-Id: Ifa002809d426aa04109592e53d2b02a224f51101
Signed-off-by: Simon Desfarges <simon.desfarges@intel.com>
2016-03-23 17:21:25 +00:00
Simon Desfarges e6ded3f581 arc_timer: fix wrong programmed limit when entering idle
The timer counts from 0 to programmed_limit included.

Change-Id: Ifc8585210c319f5452fafc911d4f6d72c4b91eaa
Signed-off-by: Simon Desfarges <simon.desfarges@intel.com>
2016-03-23 17:21:24 +00:00
Andre Guedes 300bbdc2f4 gpio: Fix returning code from stm32 driver
This patch fixes gpio_stm32 driver since it was merged with a few
occurrences of DEV_* error code.

Change-Id: I025e4f83d8ca07bc0fed7d3dcb9cce3b9d11c3fc
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-23 15:55:11 +00:00
Andre Guedes 4048a59be3 counter: Fix returning code
Counter API and drivers were merged without fixing the new returning
error convention (errno.h codes). This patch fixes all occurrences of
DEV_* codes so -E* codes are used instead.

Change-Id: I85007e8565686b52121410badea547ed904460a0
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-23 15:55:11 +00:00
Yannis Damigos f4d6dbb211 drivers: pinmux: Restructure kconfig options
Moves config options for K64 into its own config file under its
own submenu.

Change-Id: I94ccac54709ab5ec8222daa8634818d9ebc3561d
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-23 15:36:43 +00:00
Yannis Damigos f978d37466 drivers: spi: Make K64 spi submenu available only for K64 soc
Makes K64 spi driver submenu available only if K64 soc is
selected.

Change-Id: I0ada8863a592f056dbe48e78d9374f2348dcac14
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-23 15:36:43 +00:00
Yannis Damigos 489477b6b9 drivers: pwm: Make K64 pwm submenu available only for K64 soc
Makes K64 pwm driver submenu available only if K64 soc is
selected.

Change-Id: I9959b4785c6deab01977f86bbbebe3d671a4eec7
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-23 15:36:42 +00:00
Johan Hedberg cb5f5d2423 drivers/nble: Fix validation of advertising parameters
According to the Core Sepcification, Advertising Interval Min/Max
shall not be set to less than 0x00a0 if ADV_SCAN_IND or ADV_NONCONN_IND
type is used.

Change-Id: I6c4ef4f73b82841c3a96694dda670cdd12a40a54
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-23 06:14:30 +00:00
Yannis Damigos d7a21260b6 drivers: gpio: Make K64 gpio submenu available only for K64 soc
Makes K64 gpio driver submenu available only if K64 soc is
selected.

Change-Id: I4097006a4dca718ed2da730fa85cd2ad9970f419
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-21 19:41:06 +02:00
Yannis Damigos 3a977ae654 drivers: gpio: Move STM32 gpio driver under its own submenu
Moves STM32 gpio driver under its own submenu, like atmel SAM3
and K64 gpio drivers.

Change-Id: Iebc474af9818a73275f99183d3f4788eea1e6ded
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-21 16:51:43 +00:00
Maciek Borzecki 61c0363257 clock_control/stm32f1: HSE support and PLL configuration cleanup
Add support for use of HSE (incorrectly named PREDIV1)as input of PLL,
along with HSE bypass for stabilized external clock, and XTPRE
prescaler. Update PLL handling so that we do not unnecessarily enable
PLL clocks, instead enabling only the clocks sources that are required
as per user's configuration.

This change allows higher SYSCLK clock values, up to 72MHz.

Change-Id: Ia7c2be3ce11ac0de2efa664b20e7ab5fddd57a51
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-21 16:36:13 +00:00
Andrei Emeltchenko 59659ce4da drivers/nble: Re-enable advertising on disconnect
Move re-enabling logic to the NBLE stack.

Change-Id: I1b895aa952a241dc41e2fc9faa2794a8c2c2d2db
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-21 09:21:24 +00:00
Andrei Emeltchenko a881ef8c4d drivers/nble: Move auth callback to nble struct
Keep authentication callback structure inside nble.

Change-Id: I5a577e4c093c4bbfece0d2cac3de94cff78349d2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-21 09:21:10 +00:00
Andrei Emeltchenko e0c143233e drivers/nble: Move local bdaddr to nble structure
Create nble structure and move bdaddr there.

Change-Id: I4fb920364c03ba5d10931efa7673b1cb433bcd5c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-21 09:21:01 +00:00
Andrei Emeltchenko a896e00ccf drivers/nble: Implement common response
Implement on_nble_common_rsp() RPC event.

Change-Id: I066a3d5a698dc038903a202595a0d197456a65d8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-21 09:20:50 +00:00
Anas Nashif 2f20933cad sensors: Convert return codes to errno.h
Change-Id: Ifdcc26c903e70c4f72ac94e0511cc3f01fa6dc6e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-21 09:16:40 +00:00
Vinicius Costa Gomes de5dd2f0ff k64f: Fix indentation in the K64F pinmux driver
Change-Id: Ied78a3168b134dfdfce21ad25b530bb87db283b0
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-03-19 10:44:39 +00:00
Murtaza Alexandru 3b6d4cb9cf sensor: add driver for BMC150 magnetometer
Add device driver for the magnetometer part of BMC150 sensor.

Datasheet:
  https://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS000-04.pdf

Change-Id: Id7cbfd872a0a37e20afb03a8155c1f6851710a16
Signed-off-by: Murtaza Alexandru <alexandru.murtaza@intel.com>
2016-03-19 06:39:42 -04:00
Bogdan Davidoaia ef65f155c2 sensor: add driver for HDC1008 temperature and humidity sensor
Add driver for the HDC1008 temperature and relative humidity
sensor.

Datasheet:
	http://www.ti.com/lit/ds/symlink/hdc1008.pdf

Origin: Original
Change-Id: I63cb4cdd94120b80d0d6f3205da073f0817c4f17
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-19 06:39:42 -04:00
Bogdan Davidoaia 653874c73f sensor: add driver for SHT3xD sensors
Add device driver for the SHT3xD temperature and humidity sensors.

Datasheets:
	https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Datasheet_digital.pdf
	https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Application_Note_Alert_Mode_DIS_V1.pdf

Origin: Original
Change-Id: I9cda2f1bc7172e93ce34fde63c6febf0b8b28289
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-19 06:39:42 -04:00
Bogdan Davidoaia babb62a0ed sensor: add isl29035 light sensor
Add device driver for the isl29035 ambient light and infrared
light sensor.

Datasheet:
    http://www.intersil.com/content/dam/Intersil/documents/isl2/isl29035.pdf

Origin: Original
Change-Id: Ib285f8def32d78d50f1d92998dca5f55d6603ca5
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-19 10:38:39 +00:00
Daniel Leung fa868a7846 drivers: bluetooth: nble: restructures Bluetooth Kconfig options
This moves both the Bluetooth HCI and NBLE drivers under
"Bluetooth Drivers" category. This also adds a selection for
choosing Bluetooth stacks as the bulk of both HCI and NBLE stacks
cannot be compiled together.

Note that this does not move the source files. That should be
done in a separate change.

Change-Id: I32fa7097ada0fdc52bcc745adb78c7273f4023c6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-19 00:23:11 +00:00
Bogdan Davidoaia fe9c947fee sensor: add driver for BMA280 accelerometer
Add device driver for the BMA280 I2C-based triaxial accelerometer
sensor, which supports reading data from the accel-x, accel-y, accel-z
and temperature channels. The driver also has support for data-ready
and any-motion triggers.

Datasheet:
	http://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMA280-DS000-11_published.pdf

Origin: Original
Change-Id: Iff7246d7dd4a9358ec7a71e8ffbcfcccd49e393c
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
Signed-off-by: Teodora Baluta <teodora.baluta@intel.com>
2016-03-19 00:13:18 +00:00
Andre Guedes ace49af6b0 uart: Enable QMSI driver for Quark D2000
This patch fixes the QMSI UART shim driver so we are able to use it in
Quark D2000 based platforms. Differently from Quark SE, the peripheral
clock gate bit (CLK_PERIPH_CLK) is not enabled by default in Quark
D2000. We have to explicitly set this bit in order to properly initialize
the device.

Since this drivers is now properly working on Quark D2000, this patch
also sets the QMSI driver default options in arch/x86/soc/quark_d2000/
Kconfig.

Change-Id: I817b7703554be162ac628dcd8d3d07512b9eb3f5
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-18 23:33:06 +00:00
Andre Guedes 3172fca3a0 drivers: qmsi: Fix gpio, i2c and wdt for D2000
This patch fixes the gpio, i2c and watchdog shim drivers so they set the
CLK_PERIPH_CLK bit during driver initialization. Differently from Quark
SE, the peripheral clock gate bit (CLK_PERIPH_CLK) is not enabled by
default in Quark D2000. We have to explicitly set this bit in order to
properly initialize the device.

This issue has been masked so far because the CLK_PERIPH_CLK bit is set
when UART NS16550 driver is enabled. The UART NS16550 driver is enabled
by default for Quark D2000 so gpio, i2c and watchdog sample apps were
working just fine. But if we disable the NS16550 driver, these samples
applications stop working.

The remaining shim drivers already set the CLK_PERIPH_CLK bit during
initialization so there is no need to fix them.

Change-Id: I3f658da564f87e9d52092ce7aac423c7b3e0c890
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-18 23:31:45 +00:00
Maciek Borzecki 624c9e339a watchdog/iwdg_stm32: add driver for STM32 Independent Watchdog (IWDG)
Add a driver for Independent Watchdog (IWDG) commonly found in STM32
MCUs. The driver has been tested on STM32F1 family MCU.

Change-Id: Idc6ac35990e46901a206b4af0ce3767eb4875de9
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 20:57:26 +00:00
Maciek Borzecki 1524e713c5 gpio/stm32: GPIO input with interrupts
Add support for interrupts for input GPIO pins on STM32 MCUs. The SoC
support code is expected to provide an implementation of
stm32_gpio_enable_int() call.

Change-Id: I61bae54b8e044be4d7d8eb60c0c67b71f8c59553
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 20:55:21 +00:00
Maciek Borzecki 33907674dd interupt_controller/stm32_exti: driver for STM32 EXTI controller
Introcuce a driver for External Interrupt/Event Controller (EXTI) found
on STM32 MCUs.

Change-Id: Ib206521fcc51b5dfaaf5dea9d436f8304f3a36be
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 20:53:06 +00:00
Maciek Borzecki 0cd7ff8d4b serial/stm32: add support for IRQ APIs
The patch extends STM32 serial port driver with support for IRQ API of
the common UART port driver API.

Change-Id: If105e8528ea4ed4181cc4af0c97c24aa874e69e0
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 20:52:00 +00:00
Maciek Borzecki 5a73ca6809 serial/stm32: add driver for STM32 UART
Add driver for U(S)ART ports on STM32 MCUs. The driver implements basic
RX/TX functionality. Data transmission is implemented using polling. The
driver configures the port to use 8bit data transmission, 1 stop bit, no
parity control.

The driver exposes a public uart driver API and registers a single UART
device 'UART_0'. The device binds to USART1 peripheral and performs
required pinmux and clock control configuration. The device can be
initialized at the PRIMARY level, with default device priority.

The driver has been verified to work with a sample Hello World
application on a STM32F103 series MCU.

Change-Id: Iae103fcd8d2fb0a6c173cf141a68e17791255aab
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 20:20:28 +01:00
Maciek Borzecki a8700114b3 soc/stm32f1/pinmux: implement STM32 pinmux integration
Add necessary integration code enabling use of common STM32 pinmux
driver.

The alternate function listing currently consists of USART1 pins
only. The listing should be updated when support for more devices is
added.

Change-Id: Ic65aeea9df9aaea7636ecdd6996f56e6ef59dc2f
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 16:27:04 +01:00
Maciek Borzecki 6461e70b72 gpio/stm32: add common driver for STM32 GPIO
The driver implements a GPIO device interface for STM32 MCUs. Each SoC
must provide implementation of the follwoing calls:
stm32_gpio_flags_to_conf(), stm32_gpio_configure(),
stm32_gpio_set(). Consult gpio_stm32.h header for details on semantics
of these calls.

The driver registers 5 devices, each corresponding to a single GPIO
port. The users can then access individual pins by using values
0-15.

Change-Id: Id236b5b75c9dd091018a50a7be3501c8591cd551
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 16:27:04 +01:00
Maciek Borzecki e53390f02d pinmux/stm32: add common driver for STM32 pinmux
Add a common driver for pin control subsystem in STM32 MCU series. The
driver allows for selection of pin's function without the ability of pin
remapping.

The driver implements a pinmux driver API, with custom `func` and `pin`
encoding in API calls. The caller is expected to use STM32PIN() helper
macro for encoding port/pin numbers or using one of the provided
STM32_PIN_* defines.

The common driver requires SoC specific support to be implemented. The
SoC code must implement these calls: stm32_get_pin_config(),
stm32_get_port_clock(), stm32_pin_configure(). Consult pinmux_stm32.h
header for detailn on semantics of these calls.

The driver also requires board level integration. The call
stm32_board_get_pinconf() is expected to privide pin function
assignments for the target board.

Whenever an IO pin is being enabled, the driver will automatically
enable the clock for corresponding port. The driver does not implement
disabling of port's clock as this has potentially disruptive, as such
such operation should be done explicitly in the code.

The pin control module needs to be initialized before any other modules,
but after clock_control. For this reason, the driver is initialized by
default at PRIMARY level, with priority set to 2. The priority can be
changed through configuration.

Change-Id: I8cb746d0f3cad72cd50b3355fe6d93a9f469be25
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-18 16:27:04 +01:00
Andrei Emeltchenko f3ebc5bf97 drivers/nble: Check firmware version for compatibility
Current design of Nordic RPC requires strict firmware compatibility,
add check indicating if firmware is incompatible. At the moment we
allow to continue since something may work :).

Change-Id: Ie67d4a6509e53553ae6c41a2c8d2593ab20bdcfb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-18 15:22:13 +00:00
Andrei Emeltchenko eb1e41d1e7 drivers/nble: Update valid advertise parameters
Allow to use Non Resolvable Private Address (NRPA) in advertisement,
following NBLE change.

Change-Id: I9491cfcd2e981237c99e55773a8beaddaee8b730
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-18 15:20:38 +00:00
Andrei Emeltchenko 4961833fd4 drivers/nble: Update RPC to Nordic BLE firmware
Update firmware version to 0317. Changes are mostly related to
advertising.

Change-Id: I3a438ad38e3c892e354f7ea59b99739153957f19
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-18 15:19:57 +00:00
Daniel Leung 2735e1fa82 adc: move each driver kconfig options into submenus
This moves the kconfig options for each drivers into their own
submenus. This makes menuconfig easier to navigate.

Change-Id: I2bdc8c3b61e424248ffb65385a7eabc797d89684
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-18 11:27:09 +00:00
Daniel Leung 770c6e7ca5 clock_control/stm32f10x: move kconfigs into its submenu
Moves the kconfig options for STM32F10X clock control driver
into its own submenu.

Change-Id: I9ef658defe85feab3dfdb3e329710cb48bbffd86
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-18 11:27:09 +00:00
Daniel Leung e143d6dd59 clock_control/quark_se: fix default kconfig dependencies
() Moves the Quark SE clock control into its submenu.
() Fixes the dependencies in the SoC default Kconfig
   so the options are not displayed out of place in
   menuconfig.

Change-Id: Ifdf06242be8ceed03c2c657c942875a5a7f2750e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-18 11:27:09 +00:00
Daniel Leung 50bd5e72f7 aio: put driver kconfigs under submenus
Put the kconfig options for individual drivers into
their own submenus. This makes it easier to navigate.

Change-Id: I96b230c3236722c809337472f7efdc2dc1bafdee
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-18 11:27:09 +00:00
Genaro Saucedo Tejada d1e9181fd4 sys_log: Grove driver update to new logging API
Replaces old DBG calls by new SYS_LOG_... ones, likewise updates the
grove/Kconfig file to include new per-level logging control.

Change-Id: I638ffa915a760b4f188c1bfa2dc68e63cbf7e624
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-03-18 00:01:21 +00:00
Daniel Leung bf40dec92e pwm: restructure Kconfig options
() Moves config options for each controllers into their own
   Kconfig files. This keeps upper level Kconfig from getting
   too big.
() Options for each controller are moved under their own
   submenus.

Origin: refactored from existing file
Change-Id: I77e92f72f8de85abaedfbe078283607b7c242c81
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-17 21:05:12 +00:00
Daniel Leung a33aecc611 spi: restructure kconfig options
() Moves config options for each controllers into their own
   Kconfig files. This keeps upper level Kconfig from getting
   too big.
() Options for each controller are moved under their own
   submenus.

Origin: refactored from existing file
Change-Id: I813694f26126b43523b08ebdb0a5383edd241cda
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-17 21:05:12 +00:00
Daniel Leung 68107289bd i2c: restructure kconfig options
() Moves config options for each controllers into their own
   Kconfig files. This keeps upper level Kconfig from getting
   too big.
() Options for each controller are moved under their own
   submenus.
() Adds the missing copyright to Kconfig.atmel_sam3.

Origin: refactored from existing file
Change-Id: I2dacd3d9b2bfa052c9e0c078ddffed40dbc2ddbf
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-17 21:05:12 +00:00
Daniel Leung 1904ecc0b5 gpio: restructure Kconfig options
() Moves config options for each controllers into their own
   Kconfig files. This keeps drivers/gpio/Kconfig from getting
   too big.
() Options for each controller are moved under their own
   submenus.
() Re-named the device names to standard as "GPIO_0", "GPIO_1",
   etc.
() Adds the missing copyright to Kconfig.atmel_sam3.

Origin: refactored from existing file
Change-Id: I7c531b0109ca5a6840d3abd9daa6bc784f15233d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-17 21:05:12 +00:00
Daniel Leung e369cb85a6 serial: minor kconfig semantic changes
() Adds some comment to divide config options for easier
   visual navigation.
() Put config under submenus to make all driver options
   consistent with each other.

Change-Id: Ia219c5283e4fa394adf8b0ac03577a0fd033ec1c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-17 21:05:11 +00:00
Johan Hedberg b84f60cab3 Bluetooth: Move stack analysis helper to a global location
The helper for analyzing (fiber) stack usage is in no way specific to
Bluetooth and will likely be of use to many other places as well. Move
it therefore to include/misc.

Change-Id: Iedb699dbe248aca305e387998d37bb339cfb0e21
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-17 16:29:05 +00:00
Bogdan Davidoaia aad3e2a21e sensor: move driver specific options to separate Kconfig files
Move driver specific config options to separate Kconfig sub-files
as this is a more scalable approach when considering that multiple
sensor drivers will be added in the future.

Change-Id: Ia1d62afd628723be33868d6c1a956ca7b27eba88
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-03-17 15:59:17 +00:00
Baohong Liu 97c5df695e drivers: Quark AON counter and timer support
Quark AON counter and timer sub-drivers. They are based
on the QMSI drivers.

In order to enable this driver, the following options
must be set.
CONFIG_QMSI_DRIVERS
CONFIG_QMSI_INSTALL_PATH
CONFIG_COUNTER

Origin: Original

Change-Id: Idbeabfaef3408f4d645b0e64a337d7f5f0f357c7
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-03-17 08:59:04 -04:00
Baohong Liu ea5b4e4943 API: Add public counter API
Add the public API for counter devices and the drivers infrastructure.

Origin: Original

Change-Id: If100fbc9b3d119ce2be6c131bd64dbeb4fe346f2
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-03-17 08:59:04 -04:00
Andre Guedes 136d171588 drivers: Replace DEV_NOT_CONFIG by -EPERM
This patch replaces all occurences of the macro DEV_NOT_CONFIG by
-EPERM at the driver level. This patch is part of the effort to
transition from DEV_* codes to errno.h codes.

Change-Id: I3054c8aa76319a58a2eec089b8a72bf301c85391
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes aca7cb1efd drivers: Replace DEV_NO_SUPPORT by -ENODEV
This patch replaces all occurences of the macro DEV_NO_SUPPORT by
-ENODEV at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I03007527367b03e6fd72a85004b7d3b81046a6a6
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 2a4c5fce00 drivers: Replace DEV_NO_ACCESS by -EACCES
This patch replaces all occurences of the macro DEV_NO_ACCESS by
-EACCES at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: Ic7fd162b45e9ceb73141a164649b96eea9886873
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes afcc923172 drivers: Replace DEV_USED by -EBUSY
This patch replaces all occurences of the macro DEV_USED by -EBUSY
at the driver level. So this patch touch the files under drivers/,
include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I21eb3ffe9bdfde98593dcf63c50a8bdcd376e49e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes b3cb3a1f68 drivers: Replace DEV_INVALID_CONF by -EINVAL
This patch replaces all occurences of the macro DEV_INVALID_CONF by
-EINVAL at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: Idae0d5af8dd780416977c9261a5fb6188c3aab64
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 245e140da6 drivers: Replace DEV_INVALID_OP by -ENOTSUP
This patch replaces all occurences of the macro DEV_INVALID_OP by
-ENOTSUP at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I46aec3c65963018c479b01602e4a3eec8650eaff
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 7c956d2ece drivers: Replace DEV_FAIL by -EIO
This patch replaces all occurences of the macro DEV_FAIL by -EIO
at the driver level. So this patch touch the files under drivers/,
include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I0594ab5dbe667e074c250129e7c13ce512ac940f
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 024cfe754e drivers: Replace DEV_OK by 0
This patch replaces all occurences of the macro DEV_OK by the actual
value 0 at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I69980ecb9755f2fb026de5668ae9c21a4ae62d1e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 5f1988f284 pinmux: Change returning type from pinmux.h APIs
All driver APIs (i2c, spi, gpio, etc.) return 'int' type, but pinmux
APIs. So this patch changes the returning type from 'uint32_t' to
'int' from include/pinmux.h and fixes all pinmux drivers according.

Besides keeping consistency between all drivers APIs, this patch is
also applicable for the errno.h code transition. Pinmux drivers will
return negative errno.h codes so returning 'int' is more suitable
than 'uint32_t'.

Change-Id: I2a6e92d567a0e21fec363226da6197df94657d4b
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:46:05 +00:00
Maciek Borzecki 3f5af00529 clock_control/stm32f10x: introduce driver for STM32F10x RCC
The patch adds a driver for STM32F10x series RCC (Reset and Clock
Control) subsystem.

The module is primarily responsible for setting up of MCU's clock
tree. In particular the driver sets up SYSCLK, PLL (with source
configuration), AHB prescaler, and APB1/APB2 prescalers. As part of this
functionality, the subsystem can enable/disable clock signal for
particular peripherals, thus reducing the power consumption of the MCU.

The driver implements clock control driver API. However, subsystem IDs
being HW specific are exposed in driver public header that must be
included by callers. The driver registers a single device using a common
name STM32_CLOCK_CONTROL_NAME. The device is initialized at
the PRIMARY level with priority 1. This allows the initialization to
take place right after SoC initialization routine.

The driver depends on selection of SOC_STM32F1X config option and is MCU
specific.

Change-Id: I8bea5db20726a24bce7b7ffe0b95de543240429a
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-16 18:11:18 +00:00
Maciek Borzecki 14482f0940 clock_control: extend API with clock rate query operation
Extend the public API of clock_control driver with a function for
querying of clock rate driving given peripheral. This is useful when the
driver must calculate or configurae values that depend on the rate of
clock driving this subsystem.

A baud rate setting of UART port is an example of such operation. To
configure a particular baud rate the driver may need to set the internal
counters of UART port, where the actual value will depend on the clock
rate for this peripheral.

The implementation returns DEV_NO_SUPPORT for clock_control drivers that
do not implement such functionality.

Change-Id: I4e7ec96cd3678a4bb1ff289b0247488289310f2d
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-16 18:09:32 +00:00
Maciek Borzecki 5cff3cc561 clock_control/Kconfig: move quark_se entries to separate file
Move quark_se clock control entries to separate file. This will help to
keep things organized once we add more clock control drivers.

Change-Id: Id8f4a94189ab5bbba9b6552777549cf426d79273
Origin: Original
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-16 18:08:11 +00:00
Andrei Emeltchenko 69805d0e9a drivers/nble: Implement passkey entry event
Implement on_nble_gap_sm_passkey_display_evt() calling passkey_entry
callback.

Change-Id: Iccad494480bd12b5f5ba51f2f64c3793cdf7ba09
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 13:26:58 +00:00
Andrei Emeltchenko 5fbcdf711d drivers/nble: Implement LE stop advertising
Implement bt_le_adv_stop() and handle response.

Change-Id: Id90c98188979dbb8cd54d773149e28cb81013510
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 13:26:48 +00:00
Andrei Emeltchenko 19013cf9ab drivers/nble: Implement on_nble_gap_sm_passkey_display_evt()
Implement passkey display event by calling appropriate callback from
bt_auth.

Change-Id: I95dadea454d15e139f3c840addb7a31875fa3171
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 13:26:38 +00:00
Andrei Emeltchenko ad0e8b9195 drivers/nble: Refactor DM configuration
Take into account btauth callbacks for finding out IO capabilities.

Change-Id: Ifc35a1919c7e4d1b5ebaace7f13744f9b977d7e8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 13:26:28 +00:00
Andrei Emeltchenko 8a18406f77 drivers/nble: Implement bt_conn_auth_cb_register()
Implement registering auth callbacks

Change-Id: I09d4f20c25075461fd53fdc08351d5940be22683
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 13:26:19 +00:00
Andrei Emeltchenko 998143b29c drivers/nble: Add skeleton for handling SM events
Add skeleton to handle events generated when trying to set security.

Change-Id: If9635690d50dce22a35dd0d05d8cc5046edaafee
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 13:26:06 +00:00
Andrei Emeltchenko 5ce49a844a drivers/nble: Implement bt_conn_security()
Implement bt_conn_security() for NBLE. We call
nble_gap_sm_security_req() which shall do all needed job.

Change-Id: I5fdccc2ea3e88266db8f940dc453547d5ea51f59
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 13:09:39 +00:00
Andrei Emeltchenko 04293a243e drivers/nble: Fix using UUID for GATT discover
Refactor code to be aligned with upstream Nordic BLE RPC. There UUID
is used only for primary service and characteristics.

Change-Id: I8fa840570c2535a73aaa68793a45013faacc59da
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 11:41:09 +00:00
Andrei Emeltchenko 93eabdf4c0 drivers/nble: Return -ENOTCONN when LE connection not exist
Correct error message sent to application using GATT API.

Change-Id: Ibf7f9f8943f7e11fd2cf6eaff7c2fabbcdcadba9
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 09:19:44 +00:00
Andrei Emeltchenko e510913cc4 drivers/nble: Implement bt_gatt_indicate()
Implement bt_gatt_indicate() and response to it
on_nble_gatts_send_ind_rsp().

Change-Id: Ibf427135c6385cb84f9fab4edeb3a21760a8702e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 09:19:30 +00:00
Andrei Emeltchenko 0c294021eb drivers/nble: Implement on_nble_gap_start_advertise_rsp()
Avoid "Not implemented" error messages printing "status 0" instead.

Change-Id: I763bf760c8c088f74778d43e6283cb15a11bb443
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 09:19:18 +00:00
Andrei Emeltchenko 398e9267cf drivers/nble: Use hexadecimal format specifier
For printing two octets handle use 0x%04x print format specifier.

Change-Id: Ia654d9f2a639cfb9d63647497b302205efab0869
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 09:19:04 +00:00
Andrei Emeltchenko f506195150 drivers/nble: Correct debug print statement
Change-Id: I1321504345d43282dc2607cc98fa38ed4bd1ce76
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 09:18:52 +00:00
Andrei Emeltchenko 0b309f3f73 drivers/nble: Update RPC to Nordic BLE
Update RPC to make it compatible with firmware 0309. Among other
changes mostly related to cleanup there is extra flag octet in
struct nble_discover_params.

Change-Id: Ib4dbe15a6919c251f14888090e2f1d91c150c5f2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 09:18:23 +00:00
Andrei Emeltchenko f8102960c2 drivers/nble: Implement GATT subscribe
Implement bt_gatt_subscribe() function and handle subscriptions.

Change-Id: Ib6ea63a237413ffc65d8572b14d7912d4c7d2699
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-16 09:17:21 +00:00
Daniel Leung 52caf8cfc8 arm/fsl_frdm_k64f: fix kconfig hierarchy
This makes sure the CONFIG_GPIO_K64F_* kconfig options have correct
dependencies. Or else CONFIG_GPIO_K64F can be disabled, but all
the CONFIG_GPIO_K64F_{A,B,C,D,E} are enabled.

Same goes for SPI, FTM and pinmux.

Change-Id: I8d225dea714081b14b19006d61b8f3f6afafa5ee
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-15 21:39:15 -04:00
Daniel Leung f8405637f7 drivers/gpio_dw: fix kconfig dependencies
The DesignWare GPIO options should really depend on whether
GPIO_DW is enabled.

Change-Id: I98b2964d6a0afdac89dc66a78342076afa6feec5
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-15 21:39:15 -04:00
Daniel Leung 13a591261d drivers/shared_irq: fix kconfig hierarchy
Add a menu to enclose all the shared IRQ kconfig options.

Change-Id: I8083204c53f60022c06e9c683fa9544fdc278f32
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-15 21:39:14 -04:00
Vlad Dogaru 447489dc84 sensor: Add sx9500 SAR proximity driver
Support for data-ready and near/far triggers is included.  Datasheet the
sensor available at <http://www.semtech.com/images/datasheet/sx9500_ag.pdf>.

Origin: Original
Change-Id: Idd491a8bad7e119b0ed66e655955228ffdac6e76
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-15 18:04:19 -04:00
Vlad Dogaru 49d96d95ab sensor: Add threshold trigger support for MCP9808
The MCP9808 supports threshold triggering.  Add support for this feature
in the driver and the sample application.

If triggering is activated, the driver can create its own fiber or use
the system-wide sensor fiber.

Origin: Original
Change-Id: Ie825a22245cb48cbdffba3049011e4d305975d53
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-15 18:04:19 -04:00
Vlad Dogaru 68be7b7d26 sensor: Add driver for MCP9808 temperature sensor
The driver only supports simple temperature readings.  It does not
support the alarm feature.  Datasheet available at
<http://ww1.microchip.com/downloads/en/DeviceDoc/25095A.pdf>.

Origin: Original
Change-Id: I283e6697fc6947975323d280f5ff0ba625fac5a9
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-15 18:04:19 -04:00
Vlad Dogaru 48bdd70a07 Add infrastructure for sensor drivers
Origin: Original
Change-Id: I846b1601f1bdf15ad068b27baefc4b23ffab81e3
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-03-15 19:00:08 +00:00
Anas Nashif a04e7b653b pinmux: do not depend on GPIO
Making pinmux depend on GPIO breaks many tests and configurations
when running on real hardware. This should be added as local
configuration in the defconfig instead.

Change-Id: Ibbf1c9a3428ed692937383bf85218b0c120cbe44
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-14 18:40:31 +00:00
Laurentiu Palcu 27a3f8bb10 spi: dw: arc: add delay between writing DR strobe bit and reading FIFO
According to documentation, there must be at least one cycle delay
between two consecutive writes of the DR register. Apparently, this is
true for reading too, though undocumented.

The read_dr() inline function is called as follows:

*(spi->rx_buf) = read_dr(info->regs);

which the compiler, with full optimizations on, turns it into:

ld_s       r2,[r1,24]       <- the spi->rx_buf
sr         0x80000000,[r4]  <- this is the strobe bit write !!!
lr         r4,[r4]          <- this is the FIFO read!!!
stb        r4,[r2]          <- store the result

Unfortunately, the read from the FIFO is always 0 since the FIFO data is
not yet available.

During my investigations, I found that the following code works:

sys_out32(1 << 31, info->regs + 0xd);
*(spi->rx_buf) = sys_in32(info->regs + 0xd);

This does, basically, the same thing. But the compiler inserts an
instruction in between the write/read:

sr         0x80000000,[r4] <- write of the strobe bit!!!
ld_s       r2,[r1,24]      <- the pointer goes to r2
lr         r4,[r4]         <- read from FIFO!!!
stb        r4,[r2]         <- store the result

A single clock cycle between writing the register and reading seems
to be enough for the data to become available for reading.

This patch adds a nop in the read_dr() inline function.

Change-Id: I0c216d5738d5771835b1052e2e83363e8e3abf0c
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-03-12 03:18:54 +00:00
Sergio Rodriguez 07da8afd4d aio: QMSI analog comparator driver
This creates the QMSI comparator driver which is simply a shim driver
based on the comparator driver provided by QMSI BSP.

In order to enable this driver, the following options should be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="/path/to/libqmsi/directory"
CONFIG_AIO_COMPARATOR=y
CONFIG_AIO_QMSI_COMPARATOR=y

Origin of the file: Original

Change-Id: Iad01cb80f7bb1eff1710cd76cd0afeb70c311e04
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-03-12 03:17:59 +00:00
Andre Guedes 7633279d4a uart: qmsi: Add support for IRQ APIs
This patch extends the UART QMSI driver so it supports the IRQ APIs from
include/uart.h. The IRQ APIs are enabled by the 'CONFIG_UART_INTERRUPT_
DRIVEN' option.

Differently from others APIs such as I2C and SPI, the UART API is very
low level. For that reason, the IRQ facilities (e.g. irq based transfers)
from the QMSI driver are not useful to the shim driver at the moment. In
order to implement the IRQ APIs we rely on UART registers defined by QMSI.
QMSI UART header is missing some macro definitions from IRR register so
we define them in the shim driver.

Since the IRQ trigger condition is not configurable in the QMSI shim
driver, this patch also changes drivers/serial/Kconfig so the "UART
IRQ Trigger Condition" choice doesn't appear on the menu if the QMSI
driver is selected.

Change-Id: Idf9a0f6a47af2a550a31f474d721068dca989713
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-11 23:55:13 +00:00
Andre Guedes 1de58be866 uart: qmsi: Support for line control and driver command
This patch extends the UART QMSI driver so it supports line control and
driver command APIs.

The line control function supports the baud rate option only (LINE_CTRL_
BAUD_RATE) and, at the moment, the QMSI driver doesn't have any custom
command.

Change-Id: Icc10cb39b4077ed4ccfefb1f0feecec75b79d67c
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-11 23:55:08 +00:00
Andre Guedes 27b548251e uart: qmsi: Add baud rate configuration support
This patch extends the UART QMSI driver so it supports different baud
rate configurations. The baud rate is set per UART controller via
menuconfig. The default baud rate is 115200.

Change-Id: Iad736d72bd309b8a33ab5d538251fce374e89fd2
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-11 23:55:04 +00:00
Andre Guedes d95d6c63a1 uart: Introduce QMSI shim driver
This patch introduces the QMSI UART driver which is simply a shim driver
based on UART driver provided by QMSI BSP.

This initial version implements only the mandatory APIs 'poll_in',
'poll_out' and 'err_check' which are required by trivial sample apps and
by output functionality from the console driver. The remaining APIs will
be implemented by up coming patches. The driver supports only 115200 baud
rate at the moment.

In order to enable this driver, the following options should be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="/path/to/libqmsi/directory"
CONFIG_SERIAL=y
CONFIG_UART_QMSI=y

This driver has been tested with Quark SE Devboard so this patch also
adds its platform-specific default configuration options to 'arch/x86/
soc/quark_se/Kconfig'.

Change-Id: Ibde1825d4b0349a376a8e7d91cc9de306946b62f
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-11 23:54:59 +00:00
Anas Nashif 4f9239984f Revert "microkernel: Add support for *_sleep() during initialization"
This reverts commit 0d50329105.

This breaks sanitychecks in CI. The early_sleep kernel test case is failing
randomly.

Change-Id: I015f20699c052b4089076699fc0180945c4d3d16
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-11 22:08:44 +00:00
Jukka Rissanen ee0734c1a9 cc2520: Generate a mac address in the driver
The driver should read the mac address from the chip but in
case of cc2520, the chip does not have it. So generate a
random mac address for this invocation of the device.

Change-Id: I2d0cf2ee70525e7f5e65da9fb8ceaa1a2dccecdd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-03-11 07:26:11 +00:00
Johan Hedberg 092289ffb5 flash: Use off_t for offset parameters
Now that the internal libc has the off_t type it's the natural choice
for the offset parameters in the flash API.

Change-Id: I69999999625b46634f6d3008fe1b3f82c17d357c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-11 01:09:56 +00:00
Johan Hedberg a82ed2d905 flash: Reorder data & len parameters
This makes the ordering consistent e.g. with SPI, Bluetooth and
Networking APIs. This also follows the order of parameters in the
POSIX read/write APIs.

Change-Id: I4f11c8c90ccadf176d79f6a7bbd98aac61c26cf5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-10 23:29:22 +00:00
Johan Hedberg d625e920f8 flash: Use size_t & void * for the read/write parameters
size_t is the natural type for any integer that describes a number of
bytes. For the actual data use void pointers to avoid callers having
to do explicit typecasts if the data doesn't originate in a uint8_t
array. Also use a const pointer for writing to avoid typecasts for
data that originates in a const location.

Change-Id: Idbfc14b2d61ca6189411b211c3727f857dbd4059
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-10 23:29:12 +00:00
Maciek Borzecki 2ca921867d pwm: fix K64 PWM config options dependencies
Fix dependencies of K64 PWM config options so that they do not appear at
incorrect places in the menuconfig tree hierarchy.

Change-Id: Iea8077400a1bdf3ef1c38b3bf45b7a72373bd096
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2016-03-10 23:22:49 +00:00
Dmitriy Korovkin 0d50329105 microkernel: Add support for *_sleep() during initialization
Add support for task_sleep() and fiber_sleep() during the
system initialization. When CONFIG_NANO_TIMEOUTS defined,
before the k_server() starts, kernel uses nanokernel
system clock announce and task sleep functionality.

To give device drivers early sleep functionality, the system
clock has to start on SECONDARY initialization level, same
as most of the drivers.

Change-Id: I5b3cf3da4c8d8398a966e901ab211f2fcee18dd6
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-03-10 18:39:33 +00:00
Andrei Emeltchenko 90697c3e35 drivers/nble: Implement GATT write without response
Implement GATT write without response, no signing yet.

Change-Id: Id676202ab270cf3f0b06ede26dee2f84a9965e09
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-10 16:55:56 +00:00
Andrei Emeltchenko a8612d5aa8 drivers/nble: Implement GATT write request
Implement GATT write and handle response.

Change-Id: I5f1dd48e12149534d1c7bb0096a5bddc68fd8a0d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-10 16:55:16 +00:00
Maciek Borzecki 5b1b008661 drivers/adc: fix QMSI ADC config options dependency
Config options 'Clock Radio and 'Serial Delay' appeared out of ADC menu
due to a missing dependency on ADC_QMSI.

Change-Id: Ia1ca0d5a4ea676205a5928689c2adee9e26c2691
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-10 13:28:42 +00:00
Jeff Blais 995a9ba72a arm: K64 SPI module driver
Support for Freescale/NXP K64 SPI modules, limited to:

- Master mode
- A single active set of clock and transfer attributes (CTAR0), which
includes non-adjustable delay parameters
- Tx FIFO fill and Rx FIFO drain interrupt handling
- Standard, continuous select and continuous SCK SPI transfer formats

Also, divide-by-zero code generation in this driver is prevented.
The 'volatile' attribute is added to some of the variables in the baud
rate and delay calculation functions of the K64 SPI driver in order to
prevent bad code generation by gcc toolchains for ARM seen when an
optimization setting above -O0 is used.
Specifically, a register is loaded with the constant 0 and is used as
the divisor in a following divide instruction, resulting in a
divide-by-zero exception.
This issue has been seen with gcc versions 4.8.1 (the VxWorks toolchain)
and 5.2.0 (the Zephyr SDK toolchain).

Change-Id: Ib5b2b748aad8fdfd5e8d40544e6e1abef3713abe
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 15:50:16 +00:00
Jeff Blais 1f90470a27 arm: K64F Pulse Width Modulation (PWM) support
PWM support using the Freescale K64 FlexTimer Module (FTM)

Change-Id: Iaad429c01bd877babba04e84d6a4679bd7e38120
Work-by: Mike Hirst <michael.hirst@windriver.com>
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 15:49:44 +00:00
Jeff Blais f4c7e6697d arm: Add GPIO interrupt/callback support for K64F
Interrupt and callback function support is added to the K64F GPIO driver.

The implementation is based on the Designware GPIO driver (gpio-dw.*).

Change-Id: Id88d06f748400f8f822ca98e098cb44a53678c38
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 12:54:02 +00:00
Jeff Blais 52b499fd1f arm: Freescale K64/FRDM-K64F Pinmux support
K64 pinmux support is created as a normal driver.

As opposed to the Galileo board, the pin configuration options are
defined by the MCU and are not board-specific.  Separate
platform/board-specific configuration code uses the pinmux driver for
the default pin settings. For FRDM-K64F, only the Arduino pins (22 of a
possible 160) are set up.

Some of the I/O pins routed to the Arduino header are also configured as
JTAG/SWD signals by default and are used by the OpenSDAv2 debug
interface.  Therefore, a PRESERVE_JTAG_IO_PINS config option was created
for the FRDM-K64 platform to prevent the default pin settings from
re-configuring these pins.

The K64 MCU separates pin configuration and control, implemented in the
pinmux driver, from GPIO.  This results in some cross referencing
between the K64 GPIO driver and the K64 pinmux driver due to the
dependencies of one on the other.

This pinmux driver also uses the expanded pinmux function/mode parameter
size to describe pin configuration options with bit fields for the K64,
including up to 8 pin functions, plus interrupt, pullup/down, drive
strength, open-drain and slew rate.

The following GCC warnings in the K64 pinmux driver are prevented when not
compiling with 'no-optimization' (-O0):

warning: 'gpio_dev' may be used uninitialized in this function
[-Wmaybe-uninitialized]

Change-Id: Ie5031d18750143bf895883058b3cd55fd9989fd3
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 11:58:02 +00:00
Andrei Emeltchenko ed14803c27 drivers/nble: Implement GATT read request
Implement GATT read reusing gatt_private to store GATT parameters.

Change-Id: Ie3c58a6272cc7cf380e4d3a04e45b191680d1ebe
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-09 10:19:58 +00:00
Jeff Blais 59359595fe pinmux: Expand the pin function/mode parameter size
The pinmux API was modified to expand the meaning of the 'func' argument
to allow it to represent more than a pre-configured function.  This was done
to reasonably accommodate a larger range of pin configuration options
offered by other MCUs, such as the Freescale K64 (up to 8 pin functions,
plus interrupt, pullup/down, drive strength, open-drain, slew rate, etc.).

This allows bit fields to be used to define various settings.

Change-Id: I2b216b822c6bae7133eed01c8c3339bb47b6c5db
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 06:39:16 +00:00
Jeff Blais 0fd7af2a52 arm: Freescale K64 GPIO driver
Basic driver support for the Freescale K64 GPIO module.

Note that only pin direction, read and write are supported.

Change-Id: I6587bb260197a00497be9ac991002e3dde54718d
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-03-09 06:39:16 +00:00
Maciek Borzecki 9d61f61453 clock_control/Kconfig: fix quark_se dependencies
Fix dependencies for external and sensor clock device names in
clock_control Kconfig.

Change-Id: I708f025cf3ce97bcd003754fb5b395712d203107
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-03-08 16:47:48 +00:00
Szymon Janc 6116d58b02 Bluetooth: Use bt_auth_cancel for pairing cancel
bt_auth_cancel can be used to cancel any type of pairing.

Change-Id: Ia1a6ba834186ab6d5082d3eb473319c2d70cf4a7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-08 15:38:59 +00:00
Andrei Emeltchenko 2ff3e1b580 drivers/nble: Rename gatt_discover to gatt_private
Change-Id: I643ae9c5468fac86ce5cb259609dd42365d67bb3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-08 11:48:05 +00:00
Andrei Emeltchenko 76ce7d67e9 drivers/nble: Rearrange header includes
Rearrange headers so that internal header files gap_internal.h and
gatt_internal.h do not source headers, they are included in *.c files.

Change-Id: I6450ab90eec1b450ee8a138da2ed72b8aaeaf616
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-08 11:47:35 +00:00
Andrei Emeltchenko a49f3058d9 drivers/nble: Remove unneeded forward declaration
Change-Id: I79bf15eee2206faf6a1c4d067f79d09c2f8ec66f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-08 11:17:38 +00:00
Andrei Emeltchenko bef9fb8189 drivers/nble: Update RPC to Nordic BLE chip
Update RPC functions and data types, works with NBLE firmware
niko-0301

Change-Id: I3538fab1d20c6e140d995a797d68486be6cd0f23
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-08 10:57:03 +00:00
Andre Guedes 2efffac34f rtc: Fix Kconfig
This patch fixes the RTC_DW configuration option. DesignWare and QMSI
drivers shouldn't have any dependency from each other. All driveris
are following this policy, but the RTC.

Change-Id: Ic6bdef492d26978aa875c54d41ef39d407ddf4e1
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-07 20:04:33 -03:00
Baohong Liu f3da05f4cb drivers: WinBond SPI flash support
SPI flash sub-driver to support WinBond SPI flash.
It is based on the generic flash driver framework.

Change-Id: I58202e38445a052fa0556b03f854e75ef836e2dd
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-03-07 19:07:50 +00:00
Luiz Augusto von Dentz 68ee16d85c Bluetooth: GATT: Add bt_gatt_indicate
This uses ATT Indicate Value command to indicate changes and wait for
confirmation response.

Change-Id: I123a00e374929d779f96a02440215c32c0e79423
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-07 16:44:15 +00:00
Baohong Liu 29c8f95ec4 drivers: framework for a generic flash driver
The framework for a generic flash driver.

Change-Id: I030eb6d88338f4d6611fc6e5cae42ac586cfdb12
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-03-07 16:13:15 +00:00
Shaul Triebitz 74e8445003 pci: Fix PCI header initialization
The arguments to memset in pci_header_get were passed in the wrong
order, causing the memset to be a no-op. Fix this.

Change-Id: I1ea6d7d87d74cff6fec9bbc88c99a4b0e460cc95
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
2016-03-07 15:29:00 +00:00
Andrei Emeltchenko ba169c5819 drivers/nble: Implement NBLE GATT discover response
Implement GATT nble_gattc_disc_rsp() function, may be tested with
bluetooth shell app.

Change-Id: I80c9596e83310902de40f6e91d2ecd4b5d2f3292
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-05 19:42:00 +00:00
Sergio Rodriguez b47df6e800 adc: QMSI ADC driver
This creates the QMSI ADC driver which is simply a shim driver based
on the ADC driver provided by QMSI BSP.

In order to enable this driver, the following options should be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="/path/to/libqmsi/directory"
CONFIG_ADC=y
CONFIG_ADC_QMSI=y

Optionally this can be set:
CONFIG_ADC_IRQ
CONFIG_ADC_PRI
CONFIG_ADC_QMSI_POLL
CONFIG_ADC_QMSI_INTERRUPT
CONFIG_ADC_QMSI_CALIBRATION
CONFIG_ADC_QMSI_CLOCK_RATIO
CONFIG_ADC_QMSI_SERIAL_DELAY
CONFIG_ADC_QMSI_SAMPLE_WIDTH

Origin of the file: This file has been created from scratch

Change-Id: Ie04776ac2ed88e56852409070edec568974f8e0d
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-03-05 18:22:32 +00:00
Sergio Rodriguez d8910a419b pwm: QMSI PWM driver
This creates the QMSI PWM driver which is simply a shim driver based
on the PWM driver provided by QMSI BSP.

In order to enable this driver, the following options should be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="/path/to/libqmsi/directory"
CONFIG_PWM=y
CONFIG_PWM_QMSI=y

Optionally this can be set:
CONFIG_PWM_QMSI_NUM_PORTS=Number of ports available, default is 1

Origin of the file: This file has been created from scratch

Change-Id: Icac90154d020babca1c11147056a3438b84b0d3f
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-03-05 18:22:03 +00:00
Daniel Leung e643cede3a uart: add ISR callback mechanism for UART drivers
The peripherals utilizing UART were required to register their own
ISR rountines. This means that all those peripherals drivers need
to know which IRQ line is attached to a UART controller, and all
the other config values required to register a ISR. This causes
scalibility issue as every board and peripherals have to define
those values.

Another reason for this patch is to support virtual serial ports.
Virtual serial ports do not have physical interrupt lines to
attach, and thus would not work.

This patch adds a simple callback mechanism, which calls a function
when UART interrupts are triggered. The low level plumbing still needs
to be done by the peripheral drivers, as these drivers may need to
access low level capability of UART to function correctly. This simply
moves the interrupt setup into the UART drivers themselves. By doing
this, the peripheral drivers do not need to know all the config values
to properly setup the interrupts and attaching the ISR. One drawback
is that this adds to the interrupt latency.

Note that this patch breaks backward compatibility in terms of
setting up interrupt for UART controller. How to use UART is still
the same.

This also addresses the following issues:

() UART driver for Atmel SAM3 currently does not support interrupts.
   So remove the code from vector table. This will be updated when
   there is interrupt support for the driver.
() Corrected some config options for Stellaris UART driver.

This was tested with samples/shell on Arduino 101, and on QEMU
(Cortex-M3 and x86).

Origin: original code
Change-Id: Ib4593d8ccd711f4e97d388c7293205d213be1aec
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-05 13:37:57 +00:00
Daniel Leung f8bf86c95f uart: serial_ns16550: exclude driver data variables under #ifdef
Not all of the variables defined in the driver data structure are
required. So put some #ifdef around them.

Change-Id: I08a0c02d9e5c6885d9b4d6237446bdb9b98f3bfa
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-05 13:37:48 +00:00
Daniel Leung a702e6f5d8 i2c: i2c_atmel_sam3: meet minimum timing requirements
The I2C has minimum timing requirements for clock signal.
This patch adds the code to make sure the minimum timing
requirements are met.

Change-Id: I3f148433e60be73866577fbe614b892481d7f69d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-05 13:36:02 +00:00
Daniel Leung 94cb883140 i2c: i2c_atmel_sam3: tweak the transfer flow for NACK and STOP
() Fixed an issue where STOP would be sent twice when a read message
   is only 1 byte.
() Skip resetting the controller when NACK is received. This is not
   an issue with the controller, so there is no need to reset
   the controller and its state machine.
() Cosmetic changes to trim lines > 80 characters.

Change-Id: If2c3b2728b3f088f7aa1fcaa6d2303ff5c4c197d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-05 13:36:02 +00:00
Johan Hedberg 0efd558cbc SPI: Change read/write buffer pointers to void *
There's no reason to require callers to cast their data to uint8_t *
when the data might e.g. originate in a packed struct or some other
data type. Instead, be nice to callers and let them use any pointer
they want. Additionally, declare the TX buffer as a const pointer so
unnecessary typecasts aren't needed for that either (if the data
originates in a const location).

Change-Id: I1482ca4e350b5a7fbda6871ed9f54f255af3aa9e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-04 20:13:21 +00:00
Johan Hedberg 8708b73c65 drivers/spi: intel: Fix typo in DBG log
This log is in spi_intel_configure, not in spi_intel_transceive.

Change-Id: I5d62dd63d0cfa2c86f2dd5f9a6d367b7ad47b355
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-04 20:13:21 +00:00
Johan Hedberg 7c5563fd3a drivers/spi: dw: Fix unaligned access
The buffers aren't guaranteed to be aligned so that they're always
aligned for uint16_t or uint32_t data. Use the available unaligned
access macros to read/write the data.

Change-Id: Ie87c108aa370af196b9c759b59ed7fb9d1ed6183
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-04 20:11:57 +00:00
Andrew Boie 24f6f36ad6 system_apic: rename irq_enable/disable
Make this explicit to conform to the abstraction layer
defined in include/irq.h

This only worked before because the preprocessor was
substituting the function prototypes.

Change-Id: Id4d46b01f1c53c3a942772640023e23796eeb43b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-04 18:52:53 +00:00
Vlad Lungu 616bf84db1 spi: intel: fix write failures at low speeds
When configured at a frequency of 2MHz, a transaction writing
3 bytes and reading 1 byte fails silently (last byte cannot be
read back from the device). Enabling CONFIG_SPI_DEBUG fixes the
issue.

Scope traces show that the transaction (from /CS assert to /CS
deassert)  takes 14us and there is activity on the MOSI line
after /CS is deasserted. A transaction writing 2 bytes and reading
3 bytes take 22us.

The issue is due to the fact that completed() deasserts /CS after
the driver has put 3 bytes in the TXFIFO and taken 1 byte from RXFIFO.
Just because the last byte made it to the TXFIFO, it doesn't mean that
it was put on the MOSI line.

The fix:
For a transaction sending T bytes and expecting R bytes, let N=max(T,R).
Send exactly N bytes and wait for exactly N bytes (or an error). This
way, we are sure that all the bytes were sent to the target device.

Also:
Stop calling pull_data() after every byte sent, it might take a while
for a byte to show up in RXFIFO.
If RFS bit is set, stop sending bytes (will be really useful with a
bigger RFT).
Flushing RXFIFO in spi_intel_transceive() is not needed anymore.

Change-Id: Ifb06a12b03e3e20d6ace4d9f3a20fc11ec3bb010
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-03-03 11:00:45 +00:00
Vlad Lungu 99cb8a6ab4 spi: intel: fix typo in port 1 configuration
Remove semicolon that triggers a build failure
when CONFIG_SPI_INTEL_PORT_1=y

Change-Id: Iea49d44059377cf9eb0b5b5e14b625cb316a65bb
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-03-03 11:00:45 +00:00
Jukka Rissanen bf2c827dcf Revert "cc2520: Rework reception logic"
This reverts commit bf77d902ac.

The commit is reverted because it causes hangs in packet
reception. After transferring data a while, the chip stops
packet reception.

Change-Id: Icb94e978e3ba526314afd5e80f35c877febe8740
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-03-01 14:22:46 +02:00
Jukka Rissanen 7795ec4435 Revert "cc2520: Turn off auto ACK"
This reverts commit e695d43fad.

This commit allows reversal of the commit
bf77d902ac which is called
"cc2520: Rework reception logic". Original code had auto ACK
turned off so we can revert this commit too.

Change-Id: Ic4979d1caa0f4341b9642d8a83ee65cf71562994
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-03-01 14:22:04 +02:00
Ravi kumar Veeramally 5913dc0cd4 cc2520: Fix resetting of CC2520_EXCFLAG0
setreg(CC2520_EXCFLAG0, 0) is in print_radio_status(), it should
be in print_exceptions_0().

Change-Id: I62bd366b850f0a1abef651cfa8de8939b6c30685
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-26 15:38:38 +00:00
Jukka Rissanen e695d43fad cc2520: Turn off auto ACK
The auto ack does not seem to work properly. I am seeing that
the driver claims to have sent a packet but nothing is seen
in the air. Because of this the auto ACK cannot be turned on
right now as it would break connectivity.

Change-Id: I4e71e14a2058cc4f64740a8f4b390ba21a01cb23
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-26 14:44:08 +00:00
Tomasz Bursztyka bf77d902ac cc2520: Rework reception logic
Setting the highest possible threshold is bogus. It will certainly work
well when packet are small, but it will be very easy to overflow RX FIFO
when these are big (which happens when a big packet is fragmented).

Instead:
- setting the threshold to the bare minimum (len + header)
- reading is made into a loop based on RX FIFO counter

Taking the opportunity to:
- Reset exceptions once printed out
- Print out "Transmitted!" instead of unbearable status

Change-Id: I8d77b88756d5c3fb42d4d0d38dd0296569db07ad
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-25 14:02:50 +01:00
Tomasz Bursztyka 988c6e9e08 cc2520: Remove useless gpio logic
cc2520 does not need to clear any gpio interruption as it does not deal
with the low level gpio hardware directly.

Change-Id: Ic568e817b23b879cdf7da791417a4a6e1f95d34a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-25 14:02:43 +01:00
Tomasz Bursztyka 6f95960c2c cc2520: Flushing RX FIFO is done through one SFLUSHRX instruction
Removing unnecessary legacy logic.

Change-Id: I658e126d90e7f6151b77089a10b98c9071b6abd2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-25 14:02:40 +01:00
Tomasz Bursztyka fd3adeaabe cc2520: 7th bit of the packet length should not be interpreted
There is no such thing as being out of sync.
1 - RX FIFO is always flushed before receiving anything.
2 - So whatever comes in, if it was rejected the hardware would not set
FIFOP high (we are on high threshold, see page 83).
3 - According to 802.15.4 specs, length cannot be bigger than 127, so
7th bit of the length should never be set. However, and for some reason,
it happens to be set (noise, memory glitch?). According to datasheet
page 75, masking this bit is useful then. The hardware does it for
itself when filtering, and that does not affect the buffer content, so
it's also up to the driver to mask it as well.

Change-Id: I30b878852076c0c9d3a92b490aaf37f826ab4541
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-25 14:02:35 +01:00
Andre Guedes 536d6ec396 i2c: Remove default value from platform-specific options
This patch removes the default value from some platform/SoC specific
options which are declared in drivers/i2c/Kconfig because 1) most of
the time they are not valid values and 2) the correct values are
already set in the SoC Kconfig.

It also moves the interrupt priority definition from the driver's
Kconfig to the platform's Kconfig since it is a platform-specific
configuration.

Change-Id: If3c260b9a2fa095de47a99eb7fa5b947efefe9b1
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-24 14:34:24 -03:00
Andre Guedes 1eaaa6434b spi: Remove default value from platform-specific options
This patch removes the default value from some platform/SoC specific
options which are declared in drivers/spi/Kconfig because 1) most of
the time they are not valid values and 2) the correct values are
already set in the SoC Kconfig.

It also moves the interrupt priority definition from the driver's
Kconfig to the platform's Kconfig since it is a platform-specific
configuration.

Change-Id: Ic992749b3210ed8a2e454edece41ceca5edbaf2e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-24 14:26:23 -03:00
Andre Guedes 55e93f203c gpio: Remove default value from platform-specific options
This patch removes the default value from some platform/SoC specific
options which are declared in drivers/gpio/Kconfig because 1) most of
the time they are not valid values and 2) the correct values are
already set in the SoC Kconfig.

It also moves the interrupt priority definition from the driver's
Kconfig to the platform's Kconfig since it is a platform-specific
configuration.

Change-Id: Id00f7907fa55025011dabce6e282a9623be23831
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-24 17:05:52 +00:00
Peter Mitsis 06e2b4e129 nanokernel: Change fiber_delayed_start() return type
Instead of returning a 'void *', the nanokernel fiber_delayed_start()
family of routines now return a handle of type nano_thread_id_t.

Consequently, the nanokernel fiber_delayed_start_cancel() family of
routines now accept a parameter of type nano_thread_id_t instead of
'void *'.

The complete list of affected nanokernel routines is:
    fiber_delayed_start()        fiber_delayed_start_cancel()
    fiber_fiber_delayed_start()  fiber_fiber_delayed_start_cancel()
    task_fiber_delayed_start()   task_fiber_delayed_start_cancel()

Change-Id: Ibd4658df3ef07e79a81b7643a8be9ea5ffe08ba0
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-23 10:48:54 -05:00
Johan Hedberg bab3b49fdb Bluetooth: Change GATT callback return values to ssize_t
Since the return value of these callbacks is a number of bytes ssize_t
is more appropriate than int.

Change-Id: I3406fb382975d62f51e7a195666d0ae88364fd2c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-20 15:39:33 +00:00
Tomasz Bursztyka ec678375a3 spi: dw: Quark SE Sensor Sub-System support
Though it's an ARC core, Quark SE SS does not follow the same registers
mapping as the official DesignWare document. Some parts are common, some
not.

Instead of bloating spi_dw.c with a lot of #ifdef or rewriting a whole
new driver though the logic is 99% the same, it's then better to:
 - centralize common macros and definitions into spi_dw.h
 - have a specific spi_dw_quark_se_ss_reg.h for register map, clock
   gating and register helpers dedicated to Quark SE SS.
 - have a spi_dw_regs.h for the common case, i.e. not Quark SE SS.

GPIO CS emulation and interrupt masking ends up then in spi_dw.h.
Clock gating is specific thus found in respective *_regs.h header.

Adding proper interrupt masks to quark_se_ss soc.h file as well.

One of the main difference is also the interrupt management: through one
line or multiple lines (one for each interrupt: rx, tx and error). On
Quark SE Sensor Sub-System it has been set to use multiple lines, thus
introducing relevant Kconfig options and managing those when configuring
the IRQs.

Quark SE SS SPI controller is also working on a lower level, i.e. it
requires a tiny bit more logic from the driver. Main example is the data
register which needs to be told what is happening from the driver.

Taking the opportunity to fix minor logic issues:
- ICR register should be cleared by reading, only on error in the ISR
  handler, but it does not harm doing it anyway and because Quark SE SS
  requires to clear up interrupt as soon as they have been handled,
  introducing a clear_interrupts() function called at the and of the ISR
  handler.
- TXFTLR should be set after each spi_transceive() since last pull_data
  might set it to 0.
- Enable the clock (i.e. open the clock gate) at initialization.
- No need to mask interrupts at spi_configure() since these are already
  masked at initialization and at the end of a transaction.
- Let's use BIT() macro when relevant.

Change-Id: I24344aaf8bff3390383a84436f516951c1a2d2a4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-20 15:39:16 +00:00
Andre Guedes 424cd841e2 spi: Enable QMSI driver for Quark D2000
This patch fixes the QMSI SPI shim driver so we are able to use it in
Quark D2000 based platforms. The only change required to enable this
driver is an #if guard in spi_qmsi_init() because the macro QM_SPI_MST_1
and the function qm_spi_master_1_isr are not defined in QMSI headers
from Quark D2000.

Since this drivers is now properly working on Quark D2000, this patch
also sets the QMSI driver default options in arch/x86/soc/quark_d2000/
Kconfig.

Change-Id: Ic6e2f7f5a2c3f350ddf360b23ffab6b812948572
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-20 14:57:45 +00:00
Andre Guedes 2a1871f405 watchdog: Remove default value from platform-specific options
This patch removes the default value from some platform/SoC specific
options which are declared in drivers/watchdog/Kconfig because 1) most
of the time they are not valid values and 2) the correct values are
already set in the SoC Kconfig (e.g. arch/x86/soc/quark_d2000/Kconfig).

For Quark D2000, the IRQ priority options (WDT_DW_IRQ_PRI and WDT_QMSI_
IRQ_PRI) values are set to '0' since the priority information is ignored
by the interrupt registering system (the interrupt vectors are fixed in
this SoC).

Change-Id: I8f36c0f0e56211cdee3f2c6fc90c7dcac0a1b5aa
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-20 14:20:33 +00:00
Andre Guedes 055d775be6 rtc: Remove default value from platform-specific options
This patch removes the default value from some platform/SoC specific
options which are declared in drivers/rtc/Kconfig because 1) most of
the time they are not valid values and 2) the correct values are
already set in the SoC Kconfig (e.g. arch/x86/soc/quark_d2000/Kconfig).

For Quark D2000, the RTC_IRQ_PRI default value is set to '0' since the
priority information is ignored by the interrupt registering system
(the interrupt vectors are fixed in this SoC).

Change-Id: I70de889cfd22e65f0e7acf7e57ddc6439f028394
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-20 14:20:32 +00:00
Andre Guedes 2b608b1e59 gpio: Enable QMSI driver for Quark D2000
This patch fixes the GPIO QMSI shim driver so we are able to use it in
Quark D2000 based platforms. To enable this driver we have to add a few
 #if guards because some macros and functions (e.g. QM_AON_GPIO_0 and
qm_aon_gpio_isr_0) are not defined in QMSI headers from Quark D2000
(this SoC doesn't support the Always-On GPIO controller).

This patch also adds the QMSI driver default options to arch/x86/soc/
quark_d2000/Kconfig.

Change-Id: Ia16a345e1de3008f167ed66f891834607c05f4a2
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-20 13:04:34 +00:00
Vinicius Costa Gomes 11ee779feb gpio: qmsi: Simplify interrupt enabling/disabling
This handling is already done by QMSI, so no need for it to be done in
Zephyr side as well.

Change-Id: Ia5c6206d3d7f04702e0be0e76f2130df8d60b31c
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-20 13:03:44 +00:00
Vinicius Costa Gomes 821212c3df drivers: gpio: Add support for AON GPIO to QMSI driver
This adds support to the AON GPIO controller using the QMSI driver.

In order to enable it, the following configuration options must be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="PATH TO LIBQMSI"
CONFIG_GPIO_QMSI=y
CONFIG_GPIO_QMSI_AON=y

Change-Id: I5a1a232d97741ad7fdbf40d8aea5a835e5b4e724
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-20 13:02:49 +00:00
Andre Guedes ec7c6a80fc i2c: Enable QMSI driver for Quark D2000
This patch fixes the QMSI I2C shim driver so we are able to use it in
Quark D2000 based platforms. The only change required to enable this
driver is an #if guard in i2c_qmsi_init() because the macro QM_I2C_1
is not defined in QMSI headers from Quark D2000.

Since this drivers is now properly tested with Quark D2000, this patch
sets the QMSI driver default options in arch/x86/soc/quark_d2000/Kconfig.
It also adds the wiring information required to test the i2c_lsm9ds0
sample app in the Quark D2000 CRB.

Change-Id: I4be03c09304da5a66ac663e48b1d72225eb5651d
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-20 02:51:49 +00:00
Andrei Emeltchenko 63ae9e6f53 drivers/nble: Export bt_conn_lookup_handle()
bt_conn_lookup_handle() would be used in gatt.c to access conn's
discovery parameters.

Change-Id: Ibb494cf8af90ccab478fa7463a41942b06029539
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-19 13:03:47 +00:00
Andrei Emeltchenko 36a59be90a drivers/nble: Store GATT discover parameters
Store GATT discover parameters in bt_conn due to lack support from
NBLE RPC.

Change-Id: I47ade89b4861c9f1260ce3a3dc158d6344de334e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-19 13:02:33 +00:00
Johan Hedberg 7078efb1ae drivers/nble: Fix GATT error response values
Change-Id: I18cc1788e429876702614ddb2810de53625e8791
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-19 12:52:32 +02:00
Benjamin Walsh 6939e0826c pci: trivial if statement refactoring
It was hard to see where the condition ended and the code block started.

Change-Id: If966b0a404beb1c783a1c8dd89e6049a6600cadf
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-17 21:57:13 +00:00
Benjamin Walsh 74cd948ed3 x1000/pci: fix coding standards
Always use braces, even on one-line code blocks.

Change-Id: Ic9e60db7f851d2fbee5bfd79cd810df23c0c5db0
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-17 21:51:57 +00:00
Andrei Emeltchenko 5d13a3ef96 drivers/nble: Fix function name
Change-Id: I124be5419ec23feeec6ac82857446c134c8c6e96
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-17 17:10:05 +02:00
Andrei Emeltchenko 1138996744 drivers/nble: Cancel connect req when receiving disconnect cmd
Cancel ongoing connect request when we receive disconnect command.

Change-Id: I12f1c1326c4b13672879b8f2dbe457cae395b486
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-17 17:10:05 +02:00
Andrei Emeltchenko dc9ff5872b drivers/nble: Implement bt_conn_disconnect()
Implement bt_conn_disconnect() API function.

Change-Id: I08979d35400cf947d7ec646bad72f625141f95e0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-17 17:10:05 +02:00
Johan Hedberg a72d967d33 Bluetooth: GATT: Expose ATT error codes to application callbacks
Introduce BT_GATT_ERR macro to make it possible for application
callbacks to return exact ATT error codes.

Change-Id: I971536508e75036fbddc40b3f33e5201e11940bc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-17 15:05:34 +00:00
Andrei Emeltchenko b125e38f9c drivers/nble: Add connection states
Connection state helps to keep make right choice when connecting /
disconnecting.

Change-Id: Ifea620c05f869a633f578bf5d5c8ba603a58a46a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-17 14:58:11 +00:00
Jukka Rissanen 086dfc2c2a cc2520: Busywait max 500ms before trying to send another packet
The 100ms wait was too short. After some debugging, the
packets were successfully sent after 250ms wait.

Change-Id: Ib367f8df81ed3039b041f1e7b46d8f562a0adcac
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-17 13:08:04 +00:00
Andrei Emeltchenko 017394c2a6 drivers/nble: Add debug option for Nordic RPC
This debug option enables debug of Nordic RPC.

Change-Id: I2e963f10ed6407b836e1572673244cb0187227d2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-16 17:20:53 +00:00
Andrei Emeltchenko fb68b8e780 drivers/nble: Enable NBLE GAP debug
Use NBLE_DEBUG_GAP to enabled / disable GAP NBLE
debug.

Change-Id: Iefbb18e697d523137a101df00b02d46e209e7f14
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-16 15:45:22 +00:00
Andrei Emeltchenko 68fcd4e04b drivers/nble: Implement client scanning
Implement Bluetooth LE scan start/stop API for Nordic.

Change-Id: I3dc153346d0135501091a4b952a3c60c081802db
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-16 15:10:01 +00:00
Andrei Emeltchenko b4bf9f8b58 drivers/nble: Implement bt_conn_create_le()
Implement bt_conn_create_le() and copy bt_le_conn_params_valid() from
net/bluetooth.

Change-Id: I6b3fff5027a82b8040c0c724eac1251945415f43
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-16 14:35:14 +00:00
Andrei Emeltchenko 0fc0472bad drivers/nble: Update connect request parameters
Structure has changed in firmware headers.

Change-Id: I0df1549ce5353a2c7807f7839ee9270e833fbbf2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-16 08:08:03 +00:00
Andrei Emeltchenko b595f27c13 drivers/nble: Clean up nble headers
Change-Id: Iec078bf3cc4ee99a7df95a687272972b793844e6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-15 14:52:31 +00:00
Andrei Emeltchenko dfb5c2172b drivers/nble: Remove not used version_header struct
Change-Id: I72ff7bf785884bf20882af536d9fa2977e70d598
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-15 14:52:22 +00:00
Andrei Emeltchenko 805a126059 drivers/nble: gatt: Implement bt_gatt_discover()
Implement bt_gatt_discover() function.

Change-Id: I1662c650fc2c9c8058c4518c5f9920647f489d40
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-15 14:52:14 +00:00
Andrei Emeltchenko 9162e6aef0 drivers/nble: Use weak function definitions
Remove empty function declaration using weak autogenerated method.
This solves API to NBLE constantly changing problem.

Change-Id: I2ff90559dfbf78e9c34e602195d8a76ab9750a47
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-15 14:51:58 +00:00
Andrei Emeltchenko d2dde33254 drivers/nble: Fix use of uninitialized data
Change-Id: I447614096180e5984b4b7a2494e0932fafe9c500
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-15 13:50:11 +00:00
Johan Hedberg 058d5b2266 drivers/nble: Kconfig: Add a note about ABI requirements
Change-Id: I2a5ff8b6944fd4022a02364bf75223af33b5cdd7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-15 12:51:28 +00:00
Andrei Emeltchenko 3df0272a38 drivers/nble: Fix use of uninitialized status
Change-Id: Id14f33ca02717ba9a3d2c7e557672b32a139752d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-15 12:43:59 +00:00
Johan Hedberg acdee60fa5 drivers/nble: Export local address for bt_conn_get_info()
The bt_conn_get_info() API also needs the local address. For now
simply use an extern declaration to get access to the variable that
resides in gap.c.

Change-Id: I3ddb598785cfb6a5d07fc10621f6d20a610536be
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-15 11:27:56 +00:00
Johan Hedberg f0315be577 drivers/nble: Track all connection parameters
The bt_conn_get_info() API requires that we track the role and the
various connection parameters.

Change-Id: I732eace1e45173f94962df3f11dbe5ad520a75cf
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-15 11:05:01 +00:00
Jukka Rissanen 44f990144b cc2520: Ignore received bogus packets silently
Instead of return 0 if there is an error, return
a value < 0 so that caller caller of cc2520_read()
can reject packet right away.

Change-Id: I99808db6aa692cf4415f630193d35e51d4bc3144
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-15 10:55:24 +00:00
Andrei Emeltchenko cde38ed754 drivers/nble: Fix passing uninitialized callback
Initialize callback to NULL.

Change-Id: I8c985fc656499f1885fbc58ddfd0f80acf2f18cf
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-15 10:25:37 +00:00
Tomasz Bursztyka a47638cdda cc2520: Add debug prints in case of packet rejection
If current packet is being rejected, it will print some more cc2520
internal insights in debug mode.

Change-Id: If63225e7dd025fb239a7bac5638624accfcc7f4f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-15 10:25:15 +00:00
Andrei Emeltchenko 123c6b8ba2 drivers/nble: Update headers following new 0215 fw release
These are mostly cosmetic changes, shall work with firmwares
niko-0214 and niko-0215.

Change-Id: Id39c6b9cee6e759f77a05259632e453492ffe498
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-15 09:57:39 +00:00
Andrei Emeltchenko 0270fe43a5 drivers/nble: Change RPC following firmware update
Due to firmware update of NBLE starting from 02/12 revisions onwards
there is a need to sync RPC headers and functions.

Only to be used with above mentioned NBLE firmware!

Change-Id: Ifc2ce28f81e819bb517ef3891610d78089a00428
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-12 16:57:56 +00:00
Johan Hedberg f15b3fbf6a drivers/nble: Take advantage of the new net_buf_pull_u8() helper
Change-Id: Ia1c90c178b385b5bdb2e60a597810aa296c4da3e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-12 16:25:47 +00:00
Johan Hedberg 1bc6597d4d Bluetooth: Take advantage of the new net_buf_pull_u8() helper
Change-Id: I41ac2bc721b916f6d939f23be293750a83d21523
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-12 16:03:43 +00:00
Johan Hedberg c3ba08c552 drivers/nble: Add proper boundary checks for function tables
We should just discard the data if the received table index goes
beyond the actual table size.

Change-Id: I267621f098e349abab5a1f37f485a28448a9396b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-12 17:10:42 +02:00
Johan Hedberg ed8c6b361f drivers/nble: Convert RPC deserialization to use net_buf
The data is in a net_buf already so we can just pass this to the
deserialization code. The net_buf context and API helps simplify the
code quite a lot.

Change-Id: Iecb62d3151d229a09538ad652508f1eb9c6c3ffc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-12 17:10:42 +02:00
Johan Hedberg 984c7a6945 Bluetooth: Kconfig: Introduce BLUETOOTH_RX_STACK_SIZE
Applications may want to fine-tune the stack size of the fiber that's
used to make callbacks into the application.

Change-Id: I2cd3e79283fe85359389528e84d9bcc21e3e19f6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-12 13:01:13 +02:00
Johan Hedberg 24730069ab drivers/nble: Make UART reading more robust
Don't require being able to read the full header in a single ISR call.
Instead track the number of received header bytes. Also check for IPC
length before allocating buffer to avoid unnecessary buffer
allocations.

Change-Id: I1678c3ac3aaf35a1b9bbe930cc2e942fce3f458a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-12 11:01:04 +00:00
Ravi kumar Veeramally d324f357ee cc2520: Fix debug prints format specifiers
Change-Id: I5d9f0629cf801022c21438e4ecc673387aceacee
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-12 10:57:37 +00:00
Benjamin Walsh e893869435 Revert "sys_clock: start the microkernel ticker in the MICROKERNEL init level"
This reverts commit 3c66686a43.

That commit fixed announcing ticks before the microkernel was up, but
prevented devices initializing before the MICROKERNEL level from having
access to the hi-res part of the system clock, which they could not poll
anymore.

Change-Id: Ia1c55d482e63d295160942f97ebc8e8afd1e8315
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-11 17:26:06 -05:00
Dan Kalowsky bfe756da7d spi : moving to a single SPI naming
Currently we have devices named "dw_spi_0" and "intel_spi_0" etc, which makes
it difficult for an application to look up.  Or worse, forcing a 3rd party IP
to hardcode in support for only one specific IP block.

Change-Id: Ie485e2350b171b66b22cd7ab39e0fcd196f38af8
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-11 11:28:18 -08:00
Sergio Rodriguez 4dee326306 tickless idle x86: Tickless idle support on nanokernel for x86
Modifications to timer drivers and interrupt setup, to manage
the tickless idle for the x86 architecture

Change-Id: Ie02d484b7e5636de6ea382ba2eeed57e704c8498
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-02-11 19:10:24 +00:00
Jukka Rissanen d1951f4f9e cc2520: Move the device init to application level
This is needed because in the microkernel, the system clock
is not yet running and the cc2520 driver needs that. By moving
the device initialization later, the clock gets to run and
the cc2520 driver works both in nanokernel and microkernel.

See also related commit 3c66686a43
for details.

Change-Id: Idc5530398b4cff2bb3e0955c8ab57c5f03344079
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-11 17:21:27 +02:00
Andrei Emeltchenko b436fa16b5 drivers/nble: Enable UART debug only if BLUETOOTH_DEBUG_DRIVER enabled
This allows to decrease number debug messages using config option.

Change-Id: I987d25c6d4b18503d6beb7feab97e9207100323d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-11 15:34:53 +02:00
Andrei Emeltchenko 14680cf4ff drivers/nble: Add Kconfig option to debug UART driver
Change-Id: I49d3b2f29039e85247329e307d17085b5b5abfe9
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-11 15:34:45 +02:00
Johan Hedberg 9632d46ae7 drivers/nble: Clean up & simplify IPC UART encoding
We can take advantage of the net_buf headroom. At the same time move
the necessary definition straight into uart.c and remove any unused
definitions.

Change-Id: I932bba2cfb11808aabce7bad09e41f94d073bb5b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-11 12:44:41 +00:00
Johan Hedberg 58ba5e8633 drivers/nble: Convert RPC serialization code to use net_buf
Using net_buf helps us remove a lot of the pointer & data length
book-keeping variables and in general makes the code more readable.

Change-Id: Iec870a3bacbb63b55329ef5214b0ee0a757f5b1e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-11 11:50:28 +00:00
Luiz Augusto von Dentz 6514cda4b2 drivers/nble: Enable debug only if CONFIG_BLUETOOTH_DEBUG_GATT is defined
This will prevent debug output to be printed if in case
CONFIG_BLUETOOTH_DEBUG_GATT is not defined.

Change-Id: I93be7ccbcf0a8eae5ecb54b174d6ed2d892673dd
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-11 11:49:50 +00:00
Luiz Augusto von Dentz badcb1dc95 drivers/nble: Add BLUETOOTH_DEBUG_GATT to Kconfig
This option can be used to enable debug for GATT using the same option
as with HCI driver.

Change-Id: Ie2f2692422bc1e1f2a5504c60d90961261b53d17
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-11 11:17:16 +00:00
Andrei Emeltchenko 028d7020c4 drivers/nble: Update data types following RPC sync
Change-Id: I04c0976720675f2b73023bdada15d4c54f81f348
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-11 10:17:36 +02:00
Andrei Emeltchenko 483f015359 drivers/nble: Print local Bluetooth address
Add printing local bdaddr to help with discovery.

...
on_ble_gap_read_bda_rsp (0xa80089a4): Local bdaddr: C3:40:54:C7:DE:B4
(random)
...

Change-Id: I19f8000b1029fdc839303203d6bac91ee76231ed
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:02 -05:00
Andrei Emeltchenko 86ae7dcb0c drivers/nble: Read local Bluetooth Address
Read and store local bdaddr, serialize command sequence.

Change-Id: Iea6a0e9d7dab3bbba04c26f47f07bc5d2527e9d7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:01 -05:00
Andrei Emeltchenko 5e3930cf12 drivers/nble: Use rsp instead of par
Using rsp instead of par makes code more intuitive.

Change-Id: Ib6594e78f4c6d0088e66e9023a696ea42a2e1f4f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:01 -05:00
Jukka Rissanen 971af2b249 cc2520: packetbuf attributes were set using wrong pointer
The buf pointer in cc2520_read() points to memory that will
hold the received data. It must not be used to set RSSI and
link quality values. Very difficult to find memory corruption
was seen as we were overwriting memory in other part of the
system. The fix was to set the RSSI and link quality variables
in read_packet() where the buf pointer points to proper memory.

Change-Id: I49bfe37f4c7ccc0f582f3aecdf73d5b3ea6bb4e5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-10 19:13:01 -05:00
Andrei Emeltchenko ecfc0d12bf drivers/nble: Clean NBLE UART driver
Remove not used code and decrease number of log messages

Change-Id: I3a41fcc15d7f7b7e8802a13f6eb871794437a87c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:01 -05:00
Johan Hedberg 7dc5596de7 drivers/nble: Pass correct handle in bt_gatt_notify
Change-Id: I90d85e681e4274722ed94dce839287e5868a93af
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Andrei Emeltchenko 7d91d3331f drivers/nble: Add debug for SM config response
Change-Id: I96b124cdf1808e1c948dd8a6511847511eacfbd2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:01 -05:00
Andrei Emeltchenko edd64e0746 drivers/nble: Update RPC to Nordic chip
Following changes in NBLE firmware update our RPC, shall be compatible
with firmware images building from 02/10.

Change-Id: Ifeb1193a241e9fea39c52a6c0f5bbd6c21041c08
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:01 -05:00
Andrei Emeltchenko bcab0a8993 drivers/nble: Add configuration for device manager
Change-Id: I6a17462bd54492c4d84b4b92bf6cfbe9a4721fab
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:01 -05:00
Johan Hedberg 4af20ab08b drivers/nble: Add initial implementation of connection callbacks
Change-Id: I0c67bedac396b870c401af2992b1754510e06720
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Johan Hedberg 97e359e6ab drivers/nble: Implement bt_conn_get_info and bt_conn_get_dst
Change-Id: Ida9ca9c499bc3789ec15705c04c32dbb22e49165
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Johan Hedberg b35bf098a0 drivers/nble: Clarify connection reference counting
Change-Id: I9ed8859cb32f240d131bb9d4ff774e2f805b16d3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Johan Hedberg 641d706597 drivers/nble: Implement bt_conn_lookup_addr_le
Change-Id: Ia22dfdc40b647e6f364fffec9963fb70609159f7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Johan Hedberg 9c3fc8aa96 drivers/nble: Remove unnecessary bt_conn_add_le function
Change-Id: I99221b0b62219d59a076e8d228c4478571714e7a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Johan Hedberg 15b7cb6f1e drivers/nble: Adjust max conn count to something more realistic
Change-Id: I0cc91cddd4848e4f0da302163d438db0fc0199dd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Andrei Emeltchenko 48b10035c5 drivers/nble: Add basic connection handling support
Add connection handling skeleton keeping interfaces similar to
net/bluetooth and putting internals to private conn_internal.h header.

...
bt: rpc_deserialize (0xa8008924): on_ble_gap_connect_evt
bt: on_ble_gap_connect_evt (0xa8008924): handle 3
...
bt: rpc_deserialize (0xa8008924): on_ble_gap_conn_update_evt
bt: bt_conn_ref (0xa8008924): handle 3 ref 2
bt: bt_conn_unref (0xa8008924): handle 3 ref 1
...
bt: rpc_deserialize (0xa8008924): on_ble_gap_disconnect_evt
bt: bt_conn_ref (0xa8008924): handle 3 ref 2
bt: on_ble_gap_disconnect_evt (0xa8008924): conn 0xa80080c4 handle 3
bt: bt_conn_unref (0xa8008924): handle 3 ref 1
bt: bt_conn_unref (0xa8008924): handle 3 ref 0
...

Change-Id: I1885ecad5c57323b7d5a68be0c63d98dc65350b3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:01 -05:00
Andrei Emeltchenko ff784b4175 drivers/nble: Add BLUETOOTH_MAX_CONN option
BLUETOOTH_MAX_CONN option is maximum number of simultaneous Bluetooth
connections supported.

Change-Id: If9629f919ba76fbd2803852c325b357c742edd9a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:01 -05:00
Luiz Augusto von Dentz e4582107f4 drivers/nble: Fix log order when receiving a write event
For example when writing to CCC descriptor it may give the impression
that a handle is being written twice when in fact it is just calling
a callback.

Change-Id: I7aca87a1678789547224ef8d64f1f6c55af8022d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-10 19:13:01 -05:00
Andrei Emeltchenko 49a145c849 drivers/nble: debug: Remove extensive debug
Change-Id: I040c43abb7d84a77312fdc633dd522b2ca319fdc
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:00 -05:00
Andrei Emeltchenko 79b086d4c3 drivers/nble: Add conn handle debug logs
Change-Id: I9754ea80cfa8f56add1945a1b5fd5b2f4ba17ea3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-10 19:13:00 -05:00
Ravi kumar Veeramally 2f0e8dc28b cc2520: Return DEV_FAIL on initialization failed case
Change-Id: I4ce3d3cafcedf58f17fb7680186b950eb903332a
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-10 19:13:00 -05:00
Ravi kumar Veeramally 3432d1b423 cc2520: Add Kconfig option for TI cc2520 channel
Default cc2520/802.15.4 channel number is 26. Using Kconfig option
user will have chance to set different channel number between
11 and 26.

Change-Id: Id8f47ab5e328adae56e00adc6437c8ca8601a658
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-10 19:13:00 -05:00
Luiz Augusto von Dentz 4efacd3d5b drivers/nble: Sync ble_gatt_notif_ind_rsp definition
The definition is not in sync with firmware which cause the following
error:

bt: rpc_deserialize (0xa8008a24): on_ble_gatts_send_notif_ind_rsp
panic: errcode -1

Change-Id: Iddaa1eece7c43b5707c01db6e053d104a2a846e6
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-10 19:13:00 -05:00
Szymon Janc 843268d78d Bluetooth: GATT: Refactor read API
Add read parameters to read callabck

Merge bt_gatt_read_multiple functionality into bt_gatt_read.
This makes it easier for application to handle all types of reads
as same sematics is kept for them.

Instead of destroy callback, call read_func with NULL data to
indicated that read has completed. This makes it clear when
read is completed and parameters used for it are no longer needed.
Thanks to this application doesn't need to abuse user data destroy
callback for detecting if read has completed. Since destroy callback
is no longer needed it is removed.

Also note that bt_gatt_read doesn't take any user data parameter
and that destroy callback was acctually called with read parameters.

If application would require to pass user data along with parameters
it may use CONTAINER_OF macro along with bt_gatt_read_params.

Change-Id: I8d6ea136b1e61c1dae73cca868b53c48c45a5492
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-10 18:52:29 -05:00
Luiz Augusto von Dentz 7e2264a065 drivers/nble: Increase rx buffer count
With peripheral application there is at least 6 commands sent in a row
which will lead to 6 responses which might cause the driver to run out
of buffers so this increases it to 8 to align with HCI driver.

Change-Id: I7ecbc2cfbaf754c35466c57124ff87d27766a07b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-10 18:52:29 -05:00
Johan Hedberg 6543318194 drivers/console: Fix writing out carriage return on all terminals
Some terminals (e.g. screen) don't seem to propagate carriage returns
through, creating the following kind of results when pressing enter in
a shell:

btshell>
         btshell>
                  btshell>
                           btshell>

Fix this by always printing out '\r' when receiving a carriage return.

Change-Id: Ia5ce5612c9b830edc84619538dc17a654b6e805b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 18:52:29 -05:00
Dan Kalowsky 5d81be5c9d adc : rename device to just ADC
Part of making the device model work, is using a more generic name for
the devices.  Currently the ADC uses 2 possible solutions, when it should
be using just one name for them all.

Change-Id: Id9b78b3edf234391819847bb9b8534747d7d4409
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-10 11:23:56 -05:00
Dan Kalowsky 9ccd5ce785 adc : ti : only one instance
There can only be one instance of an ADC, but we have code setup for
multiple.

Change-Id: I94eae2450bdc6b138ebad66f80a7c451cefe32a9
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-10 11:23:56 -05:00
Dan Kalowsky e97507a034 adc: dw: there is only one ADC
The ADC for DesignWare is currently setup to handle multiple dev entries,
but there only ever exists one.  No reason to add to complexity for multiple
if there is only going to be one.

Change-Id: I0b77ef91160776dcf0aea1a50b144fff2b2be9e2
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-10 11:23:56 -05:00
Dan Kalowsky 4743684e4f struct packing
Looking at all structs as to where we can pack them a little better, and
calling out the padding/stride at the end for future expansion.

Change-Id: I4a651092e950dd3d915af9fa0ee0d7d59803e58f
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-10 16:21:26 +00:00
Benjamin Walsh 3c66686a43 sys_clock: start the microkernel ticker in the MICROKERNEL init level
The ticker was always initialized in the NANOKERNEL init level. In a
microkernel, this can cause problems if for the some reason the
initialization of the microkernel server is delayed, such as devices
initialization in the NANOKERNEL level taking non-insignificant time to
complete. What happens in that case is the ticker ISR will start firing
and piling up events in the microkernel server stack, and quite quickly
overrun it, since it has a finite size, causing random crashes.

So, in the microkernel, initialize the ticker once the microkernel
server is available. There is no point in sending ticker event before
anyway.

Change-Id: Ie9e13184f6ad35954023faf3bbff26242284b7be
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-10 01:35:14 +00:00
Juan Manuel Cruz 21b5da27ff adc: fixes unexpected error with interrupt handler
Interrupt handler needs to finish all the handler work before
returning to the sync call.
Before this fix, a call to the API read() method could unexpectedly
fail because a second read() call could start before the previous
read() call had not completely finished.

Change-Id: I74249a52b403e2a589d970fae05b9325b20fbe38
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-08 22:19:51 -05:00
Juan Manuel Cruz ff8138595e adc: adjustments to dummy read
Per Curie documentation, the first sample from the Quark SE ADC
hardware after reset needs to be dropped.
This commits changes the location and the trigger event to do
a dummy read that drops the first sample.
Originally the driver did the dummy read on the API call enable()
and it was triggered if the ADC had awakened from suspend mode.
Because the SoC is not in suspend mode on power on and the API
enable() call has no information on the channels to be read the
dummy read could be missed.
Now the dummy read is done on the API call to read()
and triggered if it is the first time read() is called
since power on.

Change-Id: I1e1ad5f7f44d71ca88572ae242ad629471a9ab9b
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-08 22:19:51 -05:00
Andrew Boie 9fc3afc339 x86: rebase priority levels
Having priority levels 0 and 1 reserved on x86 due to implementation
details on how the CPU uses the vector table is confusing to users,
and makes it unnecessarily difficult to share drivers between arches.

Now on x86, priority levels 0 and 1 are available. Semantically, all
priority levels have had 2 subtracted from them.

It is no longer necessary to specify a priority level when the
vector itself is specified. If an IDT entry has a specific vector
associated with it, any priority argument is simply ignored.

In gen_idt, some simplifications have been made:
- The printed representation of a generated entry now fits on one line
- Some checks being done in validate_priority() were redundant, as
  generate_interrupt_vector_bitmap() also ensures that there are
  sufficient free vectors within a priority level.

Change-Id: I26669d8ee0a53f48fbc2283490a8c42d8b1daf8e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-08 21:45:07 -05:00
Tomasz Bursztyka 4f88ff49e1 spi: dw: Improve debug output
Available only when CONFIG_SPI_DEBUG is set:
- Print out all exported functions with relevant infos
- Remove superfluous messages
- Make counter in push/pull not being instanciated when not debugging

Change-Id: Iaa96a897008d360a14bc83da54152c264f42c60d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-08 21:45:07 -05:00
Tomasz Bursztyka 6ba201e288 spi: dw: If an error occurs, nothing should prevent to stop
It's a bug that did not happen, but is a valid one:
if there is an error, we should not care at all about current stage of
transmission, thus it will stop right away.

Change-Id: Iec2b519d8118233f570ded18d6c6eb4084371e5b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-08 21:45:07 -05:00
Tomasz Bursztyka ca37a84c66 cc2520: Rework the logic of reading packets
This helps saving stack but also fixes an error when unrelevant packet
detection is made and thus calls read_packet recursively.

Change-Id: I5c1130a369b573f204f30230417e5bcbb97257bc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-08 21:45:07 -05:00
Tomasz Bursztyka 2a196eca8a cc2520: Reinstate the radio locking/unlocking logic
Original mechanism was useless, but it was due to the fact prototype
code was purely polling-based. Now that we are back to interrupt mode
only, it's actually required. It's done a different way than original
though as it was really redundant, and sometimes bogus (no release).

Change-Id: I36b55b072564ee2f9d331f49c69751d9d274bab2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-08 21:45:07 -05:00
Daniel Leung 8d48828b3c i2c: adds driver for Atmel SAM3
Adds the driver to utilize the I2C/TWI interface on Atmel SAM3
family processors for I2C communication.

Note that this currently only supports master mode. Limited
testing has been done using the Fujitsu FRAM sample app.

Change-Id: Ibdb8277e47dd9450b49a66a95421eb1ffb1c4eb4
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-08 21:45:07 -05:00
Tomasz Bursztyka 3873aed032 cc2520: Reading incoming packet cannot be done under ISR context
As the GPIO callback is ran into ISR context, it's thus impossible to
start SPI transactions as these are interrupt based as well. Thus
forwarding the packet reading to an internal fiber.

If CONFIG_INIT_STACKS is set as well as debug mode, it will print out
the usage of the stack after each loop in read_packet().

CC2520 internal fiber stack size is set via Kconfig option, where the
default is set to 640 bytes. At this stage, this value cannot be fixed
so it's more flexible to be able to tweak it from a Kconfig option
rather than tweaking the source code.

Change-Id: I54138c4d1e66f6775b1ae0248574ac8eb5e44f3d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-08 21:44:54 -05:00
Johan Hedberg 242501cd60 drivers/nble: Increase rx stack size
Since application callbacks happen from the rx thread we cannot have
the stack as small as just 256 bytes. Make it 2kB for now, but later
this needs to be adjusted to some reasonable minimum with the help of
the stack analysis code, and then probably accompanied by a Kconfig
option for apps to increase if if needed.

Change-Id: Ie8e2ac41701101b874378ded1435a6fb06bae497
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:33 -05:00
Andrei Emeltchenko d4bb288f7b drivers/nble: Style fixes
Fixes some styles and removes p_buf from debug log.

Change-Id: I861c2c250d8478353f8272e9c59c06f9fc211036
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:33 -05:00
Andrei Emeltchenko 3dec8b60a2 drivers/nble: Correct style
Make code consistent and make one line less then 80 chars.

Change-Id: I4aff3542dfa150ec08ec878303011e44319b238c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:33 -05:00
Andrei Emeltchenko 99a4cac6a9 drivers/nble: Update RPC to the Nordic BLE chip
Update RPC headers to sync with NBLE firmware.

Change-Id: I3231fe16372f2a6a38868edfa543689f631d8b98
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:33 -05:00
Luiz Augusto von Dentz a1bac54378 drivers/nble: Fix not being able to register CEP attributes
Registering CEP attributes was not possible because
bt_gatt_attr_read_cep was not implemented causing the following error:

bt: bt_gatt_register: Failed to read attr: -71

Change-Id: Ib0860cf657d6a6001c1fd4dd2712ac7361edee1c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:33 -05:00
Luiz Augusto von Dentz 922b83ac38 drivers/nble: Add initial implementation of on_ble_gatts_write_evt
Change-Id: Ib28d35d6f5aac697dbbbac8e7d01e6bfcf6545c6
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:33 -05:00
Luiz Augusto von Dentz dbaa3e38cf drivers/nble: Add initial implementation of bt_gatt_notify
Change-Id: I9a5ed5092e8ae8ce9f89f53334b43a2362b91bac
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:33 -05:00
Luiz Augusto von Dentz a7462f82a8 drivers/nble: Add initial implementation of bt_gatt_write_ccc
Change-Id: Iaf565c792fee6e2d39d199519199ee34f8f4ca57
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:33 -05:00
Louis Caron 48802c2212 Bluetooth: Add API to update LE connection parameters
Applications should be able to update the connection parameters.

Change-Id: I446f64fcd0b27b605e636e566fb35a362a92de96
Signed-off-by: Louis Caron <louis.caron@intel.com>
2016-02-05 20:25:33 -05:00
Luiz Augusto von Dentz db0c12eece drivers/nble: Add initial implementation of on_ble_gatts_read_evt
Change-Id: Ia749272a23d96318f477d41d46509dc64c6d474a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:32 -05:00
Andrei Emeltchenko bb34c219ce drivers/nble: gatt: Fix loosing errcode and wrong comparision
Fix assigning negative error code to unsigned int and then compare it
against zero.

Change-Id: Idedaf91dda20a38806ee81d5c488ae8b46c8feff
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:32 -05:00
Andrei Emeltchenko 03969be306 drivers/nble: gatt: Remove unneeded check
For size_t it is hard to be negative in the following check
...
if (!data || len < 0)
...

Change-Id: Ib995d568e10aa1e3cbaf28f46d267addb876f073
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:32 -05:00
Andrei Emeltchenko 8e4ca413fd drivers/nble: Add debug tables with function strings
Since RPC to the NBLE is designed in a such a way that it is nearly
impossible to find out which packet received, create debug tables in
debug configuration. The tables store strings of function names
referenced by function index in a table, created the same way as RPC.

Sample output is:
...
bt: rpc_deserialize (0xa80082c4): on_nble_up
...

Change-Id: Ic91fcf73753aa9b78bdbacd5c8a0279823a4679e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:32 -05:00
Luiz Augusto von Dentz 629dbb624e drivers/nble: Add initial implementation of bt_gatt_register
Change-Id: I2f72c203da9b99841cd83b26b25fbf435c54baf5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:32 -05:00
Luiz Augusto von Dentz 2d220fdcf7 drivers/nble: Increase buffer size to 384 bytes
This is the MTU supported by the firmware and is necessary in order to
register bigger services such as vendor specific in the peripheral
sample.

Change-Id: I24b2f9e983d8e2da22d41a40f538f0daf7d526d0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:32 -05:00
Luiz Augusto von Dentz 94210770fd drivers/nble: Only call ready callback once get_version completes
There could be commands that depend on the firmware version the stack
needs to wait until version is complete.

Change-Id: If8ded19c4cd4eb3c33df64b3cde29da11b0de8df
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:32 -05:00
Andrei Emeltchenko 6948fc437a uart-pipe: Fix using fifo_fill instead of poll_out
For non-interrupt transfers poll_out should be used, This fixes data
lost issues on a real UART hardware like Arduino 101 and Galileo
boards.

Change-Id: Ic7a5d055941d83f9d62cbea9e911ce25730ed7b6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:32 -05:00
Andrei Emeltchenko d2c87d1e86 Bluetooth: nble: Update NBLE RPC interfaces
Following change in NBLE firmware update interfaces and structures.

Change-Id: I47df2374961d13fabc54ee8e446a155a65999072
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:32 -05:00
Johan Hedberg 0270fda003 drivers/nble: Fix error return for NRPA advertising address type
Currently the nble implementation doesn't support advertising with an
NRPA.

Change-Id: I80e3e2a72d73d23f37966eb429a8ffb8d8c50bf5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:31 -05:00
Johan Hedberg 479d25d035 Bluetooth: Rename BT_LE_ADV_ADDR_PUBLIC to BT_LE_ADV_ADDR_IDENTITY
In anticipation of supporting a local static random address in the
future it makes more sense to call BT_LE_ADV_ADDR_PUBLIC
BT_LE_ADV_ADDR_IDENTITY.

Change-Id: I4826f1dfb50b54e13a35cbe7ee74e28641c81ad1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:31 -05:00
Andrei Emeltchenko e539c3b99c Bluetooth: nble: Remove enabling debug by default
Enabling BLUETOOTH_DEBUG enables also serial console conflicting with
tester reusing the same UART.

Change-Id: I8058a019e61146ff05cc44ab543cf6ec9ff418ef
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:31 -05:00
Andrei Emeltchenko 78b0b6dd62 Bluetooth: nble: Fix warnings when debug is disabled
Use pointers instead of potentially unused var.

Change-Id: I07bcb788b0f9e5e100c913c48d7d38464565157a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:31 -05:00
Jean-Paul Etienne 4f303a9967 eth_dw: fix compilation issue in eth_dw.c driver
got the following compilation error when trying
to compile the Synopsys DesignWare Ethernet driver:
In file included from drivers/ethernet/eth_dw.c:25:0:
drivers/ethernet/eth_dw_priv.h:27:28:
fatal error: contiki/ip/uip.h: No such file or directory

Fixed by adding correct include path in ethernet
Makefile

Change-Id: I8ea50e3ffb89e54349140de124f68d196a412f8e
Signed-off-by: Jean-Paul Etienne <jean-paul.etienne@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:31 -05:00
Vinicius Costa Gomes b5ff3fe0dd spi: qmsi: Fix enabling the CS line too late
There are situations when the transfer starts before we have the time to
enable the CS line, so to be sure, we active it before even attempting
to start the transfer.

This fixes an CC2520 driver initialization issue using the QMSI SPI driver.

Change-Id: Ib9b324b77260ac537f714376c8056b1543e7e3b3
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-05 20:25:30 -05:00
Jesus Sanchez-Palencia 8d0c9124a0 gpio_qmsi: Use level sensitive interrupts
For QMSI drivers with combined interrupts, we need to use level
triggered interrupts. This is the case of the GPIO controller.

If we keep it configured as EDGE, the user will never be able to
get a pin configured as LEVEL to fire more than 1 interrupt.

Change-Id: I36bffc79183ca97f431c4f5811ed5d56e2fd82e8
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-02-05 20:25:30 -05:00
Tomasz Bursztyka c8da62567e cc2520: Fix DEVICE_INIT macro usage
config_info data comes after driver_data (though the first one is
usually the one you use first, but anyway).
Fixes a bug introduced by my commit id
3eade319e878c7e11faf4cd93a99d33737e16e6c

Change-Id: I3f58b7fd9605270bb6edf24ae0d129313ac9ab2f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:30 -05:00
Vinicius Costa Gomes 8166cf8d8f spi: qmsi: Add support for selecting the driver's init priority
Because of the necessity of using a GPIO pin as Chip Select, we need to
set the initialization priority of the SPI driver so it occurs after the
GPIO driver.

Change-Id: I02d675d8267ee07b267155a3806be85fbf57378c
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-05 20:25:29 -05:00
Vinicius Costa Gomes 39d87755c1 spi: qmsi: Add support for using a GPIO pin as CS
There are cases that it is needed to use a GPIO pin as chip
select (frames would be too long, for example), so using a GPIO pin as
chip select to keep the line active while the transfer is ongoing is the
usual solution.

This implements that solution for the QMSI shim driver.

Change-Id: Ia6b8f0f17161e20f87ad3def1468fe0abea65fdc
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-05 20:25:29 -05:00
Vinicius Costa Gomes 40f8914376 spi: Add QMSI-based implementation
This driver uses the QMSI library and mostly translates calls from the
Zephyr API to QMSI ones.

This driver conflicts with the native driver implemenation. In order to
enable it, you must set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="PATH_TO_QMSI"
CONFIG_SPI_QMSI=y
CONFIG_SPI_QMSI_PORT_0=y
CONFIG_SPI_QMSI_PORT_1=y

Missing:
 - Support for using a GPIO pin as Chip Select;

Change-Id: I0d8eca88a2a803b6b3604f396f874313fe90753c
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-05 20:25:29 -05:00
Daniel Leung f6a5bfcfa1 gpio: add driver for Atmel SAM3 PIO controllers
The PIO controllers on Atmel SAM3 family processors can be
used for GPIOs, so this is the driver.

Change-Id: I3d5712f3a0a71025b820ca1c08dd767ee1e136d8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:29 -05:00
Andre Guedes dacf54de68 i2c: Enable interrupts for QMSI shim driver
Due to an issue with the interrupt-based transfer API from QMSI driver,
the 'transfer' callback from the shim driver (i2c_qmsi_transfer) is
implemented with polling APIs. This is not ideal because we are not able
to sleep the current thread (so another task can be scheduled in) while
the i2c operation is carried out.

The interrupt issue with the QMSI driver has been solved then this patch
fixes the shim driver so it uses the interrupt-based API and adds extra
code to handle the thread synchronization.

Finally, this patch also moves all 'struct device' related definitions
from the bottom to the top of the i2c_qmsi.c file so the DEVICE_GET
macro can be used in transfer_complete() and removes the init.h include
since it is not needed anymore.

Change-Id: I7ef7ce4cea6fcc939e310e5fe12c406645f6a16e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-05 20:25:29 -05:00
Andre Guedes 4c3a1afbac i2c: Add multi controller support for QMSI shim driver
Currently, the I2C QMSI shim driver supports only the "I2C 0"
controller instance. This patch extends the driver so it supports
the "I2C 1" instance as well.

The controller instances can be enabled independently.

Change-Id: Ieb64df46816026f3f4fb262a1682c98ee36bedd5
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-05 20:25:29 -05:00
Ido Yariv 3db6a541c8 Quark: Set up IRQ routing for PCIe explicitly
IRQAGENT3 is initialized explicitly, but IRQAGENT0 isn't and its value
is based on the value the BIOS or bootloader had set before. Fix this by
explicitly initializing IRQAGENT0, and swizzle the IRQs to reduce
conflicts.

Update the pci_pin2irq function to accommodate for these changes.
Also remove pci_irq2pin function since it is unused.

Change-Id: I7b1dfc7659ab227fe66711a3af5a1f34fd4a7972
Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
2016-02-05 20:25:29 -05:00
Daniel Leung 1b6c88ffe2 aio/aio_dw_comparator: adds Kconfig for IRQ priority
Adds a Kconfig for setting IRQ priority, and set the default to 3.

This fixes an issue where the interrupt vector as placed in wrong
slot in the IDT table since the priority was zero, and thus
no interrupts from the comparator was received by ISR.

Change-Id: Ief2100c1d79e42f8cedc4e0ca21ed5f6970d62e2
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:28 -05:00
Daniel Leung 985c0b1de4 aio/aio_dw_comparator: use Kconfig to define device name
This makes the aio_dw_comparator driver to follow others by using Kconfig
to define device name. This makes using the device in apps a bit easier.

Change-Id: I4fbcb0c009c863a2216a15a78a8aa6324d95690b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:28 -05:00
Andrei Emeltchenko ca57c08e0f Bluetooth: nble: Implement get_version_rsp()
Implementing on_ble_get_version_rsp() allows to check firmware version
of Nordic BLE chip.
Current output is (stripped):
...
bt: on_ble_get_version_rsp: VERSION: 0.0.0 ATP1BLE000-1604C5546
...

Change-Id: I98d3cd659cbed86b31eb90aac0e3ae876daf616a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:28 -05:00
Anas Nashif 4414d2f308 Do not set BT config options if NBLE is not enabled
!BLUETOOTH is almost always when not using BLE, so depend
on NBLE being configured as well to set various options.

Change-Id: Idc61cee277fe0f09086a9f2ed6eb419aee5fd69c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:27 -05:00
Luiz Augusto von Dentz dab10c414b drivers/nble: Add UUID support
This reuses the existing code since that is not driver specific, with
this samples such as tester can be build using nble driver.

Change-Id: I6d9f3edf8deb2e84fce233ef02d1cd0ad6f52526
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko f4c5c9808a Bluetooth: nble: Fix missing format specifier
Change-Id: I6adbd6e19462b15644d32714ae7d454fac0ece32
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko bab5744358 Bluetooth: nble: Allow to build UART driver for nanokernel
Change-Id: I9901942521c376a22a6990835bce8ed7752a4b1a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko 44e311ed19 Bluetooth: nble: Limit number tries when reading from UART
There are situations when nble_read() might stuck reading from UART when
there is no data. Limit number of tries to 10.

Change-Id: I23380b622439ce9fa72b05f4eb527f03c749fce8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko e8ffda4a73 Bluetooth: nble: Implement ble_log
Implement using printf(), to make correct stack use define check.

Change-Id: I81894ccb511f921a5fcff37d85790191251d683f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko f8f24d7661 Bluetooth: nble: Clean up code making it consistent
Change-Id: Icfd4f245a2674d865cb670d6c4549cd39d31ca6b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 9c3de9ebca Bluetooth: nble: Use weak functions printing debug info
Since the headers defining RPC with Nordic chip changes frequently
define weak functions printing BT_WARN("Not implemented") if
function is not defined.
Weak function symbol is marked with "W" as viewed by nm.

Change-Id: Ia39b64c6e89fdddc65683711fd192a235fe754d4
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Johan Hedberg 53dd3ba2e0 drivers/nble: Implement bt_le_adv_start()
Change-Id: I169a2bc2f0e48473fbb50bdf8e651623e446c231
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:26 -05:00
Johan Hedberg 278d320f71 drivers/nble: Increase TX & RX buffer count to 2
This lowers the chance of running out of buffers when sending or
receiving a lot of data.

Change-Id: Ifedc5652f993fa54f7aded87aef545ffb49e7581
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:26 -05:00
Johan Hedberg 733f837aae drivers/nble: Fix passing correct length to poll_out()
The RPC code is not net_buf aware so it will not update the net_buf
length when encoding data into it. We have to therefore do it
ourselves.

Change-Id: I7d7d3c09007a2a9bce822625607dbf7470a7ea0b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 8dbd03a5f5 Bluetooth: nble: Make GATT coding style consistent
Make code readable removing extra spaces.

Change-Id: I61e3486e1d301ff7d36fd2e34243ff6e9111e54d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 64b1989f56 Bluetooth: nble: Make GAP coding style consistent
Remove extra spaces and make code readable

Change-Id: I3e57a5440476eb0143d19ce9865d3a76c58b90d1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko ac59405268 Bluetooth: nble: Include all functions to build
Include all functions using previously defined stubs.

Change-Id: If9ab3f02d2e3e1f27c09b0d666fcf531cf76898d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko d5100a0672 Bluetooth: nble: Enable GAP functions
Use debug stubs for now

Change-Id: I8e25ba8bb0fc4eec4d789c51e1599a17fa78cf5c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 228d0cb292 Bluetooth: nble: Enable GATT functions
Use debug stubs for now

Change-Id: Ia6f73ce3d289f3759a93eee42439fe7001770eab
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko acc88b8a71 Bluetooth: nble: Refactor header include logic
Change-Id: I4f4475360c317ba69584b34b33a1dd0f27edb022
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 702b151e47 Bluetooth: nble: Move receive logic to fiber
Move receiving logic to fiber rx_fiber(). rx_queue is registered with
uart driver and all data is sent there for processing. Clean up old
ipc_channel interface since there will be only one interface to uart
driver.

Change-Id: I292863b1f38e5adb8ca4e6ac63aed09c83de56bf
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 96aaaadca8 Bluetooth: nble: Adding NBLE ready callback
Refactored Johan Hedberg's code adding callback to be called when NBLE
is up.

Change-Id: I2a8a2238942c0adae2a5c47cfe94d8f2b1112810
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 500b59809f Bluetooth: nble: Drive BTWAKE high
Refactored Johan Hedberg's code adding writing to NBLE_BTWAKE_PIN one
to drive it high, needed to wake up NBLE chip.

Change-Id: I63b9583281db897f2326e4570716c25ce181128f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko cc190488ee Bluetooth: nble: Add basic RPC transmit code
Refactored Johan Hedberg's code adding initial transmit logic.

Change-Id: I44b0166c281d526fbd12b895b5777486c7392260
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 14613089e5 Bluetooth: nble: Add RPC deserialization functions
Port RPC deserialization to Zephyr upstream.

Change-Id: Icc9e055565185e907f51832443386f929a752586
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 79f47c65ba Bluetooth: nble: Add RPC Serialization IPC
Port RPC Serialization to Zephyr upstream

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Change-Id: I315d52dc6576254a6928520d1353856d41a25c69
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko 124795afed Bluetooth: nble: Implement bt_enable
Resets Nordic BLE chip and opens communication channel to UART.

Change-Id: Ie516869a4d978fc1622361ebc42894430fdf9ea6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko baeb34a950 Bluetooth: nble: Add UART driver for Nordic BLE chip
Adds basic support for communication with Nordic BLE (NBLE) chip
connected to UART.

Change-Id: I3651e291ec18805a63ecd3d240dce62273e3c498
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Tomasz Bursztyka 838c98b023 cc2520: Use DEVICE_INIT() relevantly
Fix a build issue, as DEVICE_INIT() is the only macro used now and
others have been removed.

Change-Id: I69f7df168f5c4284104068b79ba9097d9a1904c1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:25 -05:00
Andrew Boie 897ffaeb2c irq: rename irq_connect() to IRQ_CONNECT()
It's not a function and requires all its arguments to be build-time
constants. Make this more obvious to the end user to ease confusion.

Change-Id: I64107cf4d9db9f0e853026ce78e477060570fe6f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh a4ec963138 init: use SYS_INIT() where it makes sense
Mostly SoC initialization and some kernel subsystems, but also some
device drivers like the interrupt controllers.

Change-Id: I8dc1844c33acd877c075b6b03558fdca6f87500b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh d340d4cb3f device: use DEVICE_INIT everwhere
This is the last step before obsoleting DEVICE_DEFINE() and
DEVICE_INIT_CONFIG_DEFINE().

Change-Id: Ica4257662969048083ab9839872b4b437b8b351b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh f027902305 net: use DEVICE_GET() instead of referencing __initconfig_xxx directly
Change-Id: I5cca7bf5f882cd2870c53f29dceb64faaf5b0d6e
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh 2c1a95aee6 device: rename SYS_GET_DEVICE_NAME/SYS_GET_DEVICE
Rename them to DEVICE_NAME_GET and DEVICE_GET to fit in the 'device'
namespace.

Change-Id: I407a7f284ed4d1c071961b46615eea859c2e825f
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh 0303d8cab9 device: rename SYS_DEFINE_DEVICE()
Rename it to DEVICE_DEFINE() so that it fits in the 'device' namespace.

Change-Id: I3af3a39cf9154359b31d22729d0db9f710cd202b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh bfc27206b2 device: rename DECLARE_DEVICE_INIT_CONFIG()
Rename it to DEVICE_INIT_CONFIG_DEFINE(), because (a) it was not fitting
in any namespace and (b) it is not used to declare, but rather define a
object.

Change-Id: I1da5822f06b85a9fb024b5b184afd0ccc01012ec
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Andre Guedes 93831ebcce i2c: Fix i2c_qmsi_configure()
In the initial version of the I2C shim driver, the i2c clock gate was
enabled within i2c_qmsi_configure(). After some review rounds we decided
to move it to i2c_qmsi_init() but missed to remove the clk_periph_disable
call within i2c_qmsi_configure(). So this patch removes it.

Change-Id: Id45dba2e00a5649846d305399bc1b2b275063cb6
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-05 20:25:24 -05:00
Benjamin Walsh 99a4f13bbc device: rename synchronous_call_ APIs
Rename them to device_sync_ to fit in the device_ namespace.

Change-Id: I1088dda958584ed90b97137298050fee44c20ee4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:24 -05:00
Benjamin Walsh 2ec2f8bb62 uart: remove incorrect comment w.r.t. type of device pointer
Change-Id: Ic0523d7413dbc14dd8e44cf9c4c0b70d65d759d0
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:23 -05:00
Tomasz Bursztyka 448acf527f cc2520: Make SPI related info configurable via Kconfig
SPI, to control the CC2520 chip, is the only generic feature and thus
the only one configurable through Kconfig. GPIO on the other end depends
a lot on the SoC/Board. Adding a slave select option as well.

Change-Id: I63068fab476ed8d5b26103e4ad20e5be253c9932
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:23 -05:00
Tomasz Bursztyka 2b3e60e6df cc2520: Reworking radio on and transmission logic
FIFOP setting is a wrong assumption to know if radio is on.
Transmission runs on clock basis instead of pre-set loop counter. Thus
removing useless config option relevantly as well.
Opmitizing a bit the code as well, and making cc2520_on() public for
testing purpose.

Change-Id: I4495d1d6c19d10dcbc18f7e2fd5041720ec1f438
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:23 -05:00
Tomasz Bursztyka 930bb9d3ca cc2520: Make the driver more in line with Zephyr
CC2520 drivers as a singleton:
Current driver can only handle a single instance. This is due to the
gpio callback which cannot provide the concerned device (not the gpio
device, the cc2520 one). Setting a singleton instance for now, as the
network stack cannot handle more net devices anyway. This will be fixed
in the future.
In the mean time: improving a bit the usage of spi and gpio by accessing
the cc2520 instance directly.

Also: simplifying SPI usage, useless internal locking removed, better
debugging routines, better busy wait macro and use Zephyr's BIT() macro
instead of internal one.

Change-Id: I92b849135a92f77ee6a4374c9f662dcad8347814
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:23 -05:00
Jukka Rissanen f1563253cf cc2520: Initial checkin for TI CC2520 802.15.4 driver
Integrating it into network stack. Centralizing all in drivers/802.15.4

Change-Id: Ia2916ff652afe5fe736f6560c2ed4a911a5f0679
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:23 -05:00
Tomasz Bursztyka eb96f0a73a spi: dw: Fix Tx and Rx threshold after each push/pull
Reading: As when setting up the transfer, Rx has to adapt to current
left Tx lenght.
Writing: If nothing will be transmitted anymore, downsizing the level to
0. This fixes a hanging issue while making the controller being busy for
nothing. Another hack found to fix the same issue was to test the SR
Busy flag bit in the ISR handler. As the threshold level makes more
sense, kepping this one.

Change-Id: I87ba393d507c9418295f188d866d9979f423536c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:23 -05:00
Juan Manuel Cruz 06e2d0fe76 adc: updates sample width kconfig help message
The numeric code to configure sample width in ADC needs correction.

Change-Id: I6d73db674852650f70178322d949f9b2b49f97af
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:23 -05:00
Fabien Chereau e2e78baf68 ns16550: implement the irq_tx_empty function
Change-Id: I5b043354aefe8d54c2f8e06e06204e3de8e715b5
Signed-off-by: Fabien Chereau <fabien.chereau@intel.com>
2016-02-05 20:25:23 -05:00
Fabien Chereau b7d9842875 ns16550: implement the err_check function
Change-Id: If38bb1082f11a3be5b5d94a7122db233e6a822df
Signed-off-by: Fabien Chereau <fabien.chereau@intel.com>
2016-02-05 20:25:23 -05:00
Fabien Chereau 43ad5532df ns16550: Interruption Identification Register definitions clean up
Change-Id: I7346cec74061bce774c8fee80186d09aaf690f76
Signed-off-by: Fabien Chereau <fabien.chereau@intel.com>
2016-02-05 20:25:23 -05:00
Peter Mitsis a0e4568760 c++: Add extern "C" { } block to header files
Adds extern "C" { } blocks to header files so that they can be
safely used by C++ source files.

Change-Id: Ia4db0c36a5dac5d3de351184a297d2af0df64532
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:22 -05:00
Jesus Sanchez-Palencia 6504b7e72a gpio: Add QMSI-based implementation
Introduce the GPIO QMSI-based implementation. This is basically a
shim layer that implement's Zephyr's GPIO APIs on top of QMSI drivers.

This is an alternative driver that conflicts with the previous
GPIO_DW implementation. In order to enable it you must set:
- CONFIG_GPIO=n
- CONFIG_GPIO_QMSI=y
- CONFIG_GPIO_0=y
- CONFIG_QMSI_DRIVERS=y
- CONFIG_QMSI_INTALL_PATH="PATH_TO_QMSI"

Note that this driver currently only supports one controller instance,
GPIO_0. It is implemented this way due to a limitation from the current
version of QMSI. QMSI versions later than 1.0 doesn't have this
limitation.

Missing:
- support multiple controller instances (gpio_0, gpio_1, etc);
- enable level triggered interrupts in sync with system clock,
through setting INT_CLOCK_SYNC properly.

Change-Id: Ib61b153dae9741806a9a31d7dc1f82b96d000fbe
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 41771e5b1c adc: Repetitive buffer management
This commit changes the behavior of the driver when it reports
buffer results back through the callback.

Originally, the driver reported a callback after each sequence
table round signaled by an interrupt. If in repetitive mode,
each reported result was put in the next buffer element,
which was considered circular, and reported back with callback.

Now the behavior changes. If in repetitive mode, each sequence table
round reported by an interruption puts the data  in next element of
the reception buffer. The callback reports back once the buffer is
fulled and stops the sampling process.

Change-Id: I3707574cfaf5dfc874473f38c5dfa88dd392133d
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 51a5b96367 adc: remove of single/differential modes
On Curie SoC the ADC must always be configured in single ended mode.

Change-Id: Ie59b4180358153865c961b66f98321db60d4269f
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 87aa20ebad adc: adds dummy conversion
After exiting a deep power down mode a dummy conversion is required.

Change-Id: I98dad19e168984efe7af6ad360d0cc46e6603736
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 1e3467602a adc: fix a bug polling the power states.
Curie specs states that the ADC_PWR_MODE_STS bit in the
IO_CREG_SLV0_OBSR register must be polled to check if
the requested power mode equals the current power mode.
The bit is set to 1 when requested and current modes match
and the bit is located as the bit 0.

Change-Id: I030d7693d36fb96f09a9cbdd404118674fcb089a
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz edfe960e02 adc: adds calibration capability for dw driver.
ADC DW IP requires a calibration process each time the
IP recovers from a deep power down mode.

Change-Id: I2e02d1987af9addd9cb08a4e4e8d3848ad5b623c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Juan Manuel Cruz 65cb6dbe23 adc: removing MST_CLT and SLV_OBSR offsets
Change-Id: I1d287332036dde399875249580635c2a06fd2b5c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka d08ac2f241 clock: Make sure the clock is initialized prior to devices
On NANOKERNEL level only of course. Some devices, initialized at this
level, may require to get the clock running already.

Change-Id: Id2dd830d915474aac6c080068c2cf356cf841e0c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka bcb2e2e45c spi: dw: Rework the logic on testing/setting controller's readyness
Controller should not be enabled while configuring or setting up a
transfer call. It's enabled once the transfer call is ready to proceed,
and disabled once the last interrupt has be raised.

Change-Id: Ib9125a3600971b57e642730682f2b3bfb91b1e02
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka 6021c64844 spi: dw: Add an initialization priority Kconfig option
On Quark SE, SPI might require GPIO to be ready before hand, to emulate
CS, thus providing an option to tweak the intialization priority for SPI
DW driver.

Change-Id: Ifa373948ac8227bf6e4ed1113bcb4dc9139b6663
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka 3ef1517c1a spi: dw: Add Kconfig option to emulate CS through a GPIO pin
It might be necessary to emulate CS through a GPIO pin depending on
these 2 conditions:
- the controller's CS pin is not wired, and thus a GPIO pin is the only
  option
- The controller is unstable at a certain frequency and cannot set/unset
  CS reliably. This is actually a possible issue on DesignWare's SPI
  controller in Quark SE or Quarks D2000 where it has been found
  unstable at 1Mhz and above.

Change-Id: Ib6a06577906c005ddd347070d476a367a9c3da8a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka 655fb9fb2e spi: dw: Fix how internal FIFO is handled
- Refine how DFS is calulated now that it is strictely used to
  manipulate buffer lengths.
- Fix threshold limit
- Tune RX threshold relevantly (reduce it if rx_len is lower than actual)
- Don't push more than available left space in FIFO
- Tune the private structure to lower memory space occupation

Change-Id: I65b1b48b996b2104cebcb24cc366fb4dcbf7d53b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka bfb8b375a3 spi: Rework constants for better identification
IMR and ISR bits are same, but it stil better to differentiate them
properly. Also fixing naming where all ISR ends with an 'S'.

Change-Id: I2fc1e1d8d2743c3d98f5da40a5f4720a85c4f9a7
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka a4d8e14008 spi: dw: Add support for auxiliariy registers based access
On ARC, the SPI IP block might be accessible only via user extended
auxiliary registers, which requires different instructions to read from
and write to.

Change-Id: I3aa5f223938a9aed7795de4aedc64bd529d62942
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka 4320dffe0f spi: dw: Differentiate ARC to other arch support
Registers offsets are hopefully all the same, but size differs.
On x86, thus 32bits support, CTRL0 or DR for instance are 32 bits r/w.
And DFS on 32 bits support is placed differently as well.

Change-Id: I5115d5c3c9bba71ece4a6f4a1d3d2fdc203c8da1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:22 -05:00
Ramesh Thomas 3d5351b624 spi: dw:support all frame sizes
Only 8 bit frames were supported. Added support for bigger data frames
which can go up to 32 bits (on 32bits version of the controller, 16 bits
otherwise). Store the frame size in bytes during configure, and use it
during pull/push to read/write correct frame size.

Change-Id: Iae8c55442e0a205403aa3febd1811b36aaf4c5b6
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:22 -05:00
Tomasz Bursztyka de00223c04 spi: Make sure option are generated according to their dependencies
If SPI_INTEL is not requested, no need to instanciate specific value.

Change-Id: I5f41d919e258e420f2bd099db88ed2259f9cd27e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:21 -05:00
Tomasz Bursztyka 13c2b1ac7b spi: Rename files according to rules
Renaming files as:
<domain>_<model or manufacturer>.<c/h>

Change-Id: I018f6fdb4ba8aac8bb96e848f0f3633bd032b44e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:25:21 -05:00
Tomasz Bursztyka 7602d34949 gpio: dw: Fixing how interrupt unmasking is done for Quark SE SS
There is no such thing as "IA" in Quark SE SS as it is an ARC core. Plus
for this very specific feature it does not require the ARC aux regs
instruction to read/write in the given mask address.
And fixing also the CONFIG_ option to check.

Change-Id: I1f63348ec85f6e006795f7641c912a30fc003709
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:21 -05:00
Tomasz Bursztyka bf20dc9cec gpio: dw: Refactor how general interrupt unmasking is proceeded
This is valid only for Quark SE and Quark SE SS, where it requires to
unmask the interrupt for each specific controller. Thus making the
function generic, using the parameter as the specific mask base address.

Change-Id: Iea0a412b8d94a1ab5e1f3e339eaf632eacee5797
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:21 -05:00
Daniel Leung 21c3118655 serial: adds UART driver for SAM3X8E
This adds driver for the UART controller on Atmel SAM3X8E.
This UART controller only has two wires for RX and TX, and
does not have flow control (e.g. CTS, RTS) or FIFO.

Currently, the driver does not support any interrupt driven
operations.

Change-Id: I63720bccfb70a89888353b8ee3dfc4b80793dc01
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:21 -05:00
Tomasz Bursztyka d205c0fc74 spi: dw: Fix build issue
Introduced by commit 01d6f9f5ee0867f6ee8dc1506c2ebe62d9f296bb
Reported by Gustavo Lima Chaves

Change-Id: Ic29c33f4339c83a55ca45e93000cbc07b8dadbd2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:21 -05:00
Tomasz Bursztyka aaf542e6c7 spi: dw: Fix build error
Introduced by commit a6873a00d816daf303b0380dda91accd28df6497
Reordering the irq config function, and removing useless parameter.

Change-Id: I2d22cfe81153b104044d8672dd57115138437ed9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:21 -05:00
Andre Guedes 959632684c i2c: Introduce QMSI I2C driver
This patch introduces the QMSI I2C driver which is simply a shim driver
based on I2C driver provided by QMSI BSP.

This initial version supports only I2C_0 controller in 'master' mode.
Due to some issues with qm_i2c_master_irq_transfer API, the driver uses
the polling APIs from QMSI. This means that the current thread doesn't
sleep (i.e. is not scheduled out) while the I2C transfer is carried out.
The qm_i2c_master_irq_transfer() issue is under investigation.

Below follows the missing features which will be addressed by a new
version of this patch or by upcoming patches.
  * Block the current thread until the I2C operation has actually
    completed.
  * Add support for multiple controllers.
  * Add support for slave mode.
  * Add support for suspend() and resume() APIs.

In order to enable this driver, the following options should be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="/path/to/libqmsi/directory"
CONFIG_I2C=y
CONFIG_I2C_QMSI=y

Finally, due to the lack of proper support for Quark SE in QMSI 1.0.0,
this driver requires QMSI version greater than 1.0.0.

This driver has been tested only with Quark SE based boards.

Change-Id: I369992c7b5fe37f7e0b45be7f19e667ad1fca9ac
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-05 20:25:21 -05:00
Szymon Janc eeb29e8397 drivers/nble: Fix overwriting default Kconfig values
NBLE defaults (eg for BLUETOOTH_MAX_PAIRED) were not limited to
!BLUETOOTH  and resulted in overwriting BLUETOOTH defaults.

Change-Id: I1e4a90c00c15252bb3db927b42641f9a479f4aa6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:21 -05:00
Szymon Janc d732ac4f67 drivers/nble: Fix invalid use of Kconfig select
Select cannot be used for int type of variable. This will stil work
correctly as default value is provided. Fix following:

drivers/nble/Kconfig:50:warning: 'BLUETOOTH_MAX_PAIRED' has wrong type.
   'select' only accept arguments of boolean and tristate type

Change-Id: I15951a3ba9efa11e1c18a1e90eb708ced08ad357
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:21 -05:00
Szymon Janc c4afa61b26 drivers/nble: Fix typo in Kconfig help message
Change-Id: Ief5883abe07628095090647b2178c2df8ad980fa
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:20 -05:00
Daniel Leung 4b2a576c80 i2c/i2c_quark_se_ss: convert to using static IRQ API
This converts the i2c_quark_se_ss to use the static IRQ API.

Note that, even with separate config functions for each instance of
the driver, it is still saving both RAM and ROM space.

Change-Id: Ieb555ff281b384d87d8e69f6914878bbee0e2ee9
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:20 -05:00
Anas Nashif a704277193 watchdog: Use a common names for drivers
An application will not care about the implementation and will want
to only reference a well define name for the IP, the configuration
system will take care of the rest.

And application will bing to the drivers this way for example:

    dev = device_get_binding("WATCHDOG");

Change-Id: I8a0fde34602320de643a0ad911d19c9985600e7e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz dc2c434ff7 drivers/nble: Add BLUETOOTH_MAX_PAIRED
This makes it easier to port samples which may use
CONFIG_BLUETOOTH_MAX_PAIRED.

Change-Id: I3e37df7cae63a4ac2219ce26408ae4d4f987645d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz d65dcc5e4b Bluetooth: GATT: Replace handle with attribute object in bt_gatt_notify
This make more sense since the handles are normally self allocated by
the stack.

Change-Id: I198dd9c3ef6259cff8a0e528514918ec18990dea
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Johan Hedberg 4668ba761a drivers/nble: Add stub for bt_gatt_attr_next()
Change-Id: I0a568c62a15100b12df187fb6b0205dfbae7cc0b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:20 -05:00
Johan Hedberg f190371781 Bluetooth: Add stubs for directed advertising API
Add API definition and stubs for directed advertising.

Change-Id: Ib22d3acb6d2e76b0c638b26b8e07860cd189f640
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Johan Hedberg bc073cdb59 Bluetooth: Add bt_conn prefix for auth APIs
All of the authentication APIs deal with bt_conn objects. For
consistency it makes therefore sense to use the proper bt_conn name
space with them.

Change-Id: I47912d542373df511524cc6ad2532d6c9a76ca68
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Johan Hedberg d565ac5e1f drivers/nble: Move conn.h functions from gap.c to conn.c
Change-Id: I123e51f02e474ba1b0b7ac195a0da5900b523a53
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Johan Hedberg 25f6579016 Bluetooth: Move all bt_conn related APIs to conn.h
To have some proper split of conn.h and bluetooth.h APIs make sure all
bt_conn related ones are in conn.h. This also helps avoid forward
declarations for some upcoming patches where we need bluetooth.h
defines from within conn.h.

Change-Id: Ief3d32118a6749fb5785dab6cb3fee4ebb86ddb4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Johan Hedberg 0df7a2fac6 Bluetooth: Add error return to authentication APIs
The authentication APIs may fail, so it's fair to give the application
a chance to catch these errors.

Change-Id: I323df86b94a823b201fe22d412e6bbcaa9029550
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Johan Hedberg 3c47e9515c Bluetooth: Update advertising API
Update the advertising API according to what has recently been
discussed and agreed upon.

Naming-wise the most important change is the removal of "EIR" which
was confusing since this is mainly used with LE at the moment. The
Core Specification Supplement consistently uses the generic terms data
and data type to describe what we're dealing with here, so the new
names are bt_data and BT_DATA.

Another change is to detach the actual data from the struct by
converting it from an array to a pointer. This is not only essential
for supporting BR/EDR (which has a different length) but to also
minimize memory usage.

Another change is to require the caller of bt_le_adv_start() to
provide the array lengths of the ad and sd paramters. This way we
don't have to have the empty (8-byte) element at the end of each
array.

Lastly, the bt_le_adv_start() logic is slightly modified so that it
will always clear the respective data if necessary. Previously the
user might have been left with a previous callers data if it passed
NULL to the API.

Change-Id: I318026ceb1b52bb688edf4dcfed82613bd15c3e1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Andrei Emeltchenko 1310031915 Bluetooth: Make h4_dev static
Change-Id: I75a5655fafb8ccabbb096777ff0e2fb8be499e4f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:19 -05:00
Johan Hedberg fd975d27fb drivers/nble: Introduce basic skeleton
Introduce the basic skeleton for NBLE, which is the Bluetooth LE API
implementation targeting a custom firmware running on Nordic
Semiconductor nRF51 chips.

Change-Id: I1ce69d6ee0205e71f6bd8d256d9233c93d2cde41
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:18 -05:00
Andrei Emeltchenko 7b3317bb54 Bluetooth: h5: Fix not handling NULL when there is no buffers
In ISR context we receive NULL when there is no free buffers available.
Add handling similar to H4.

Change-Id: I9c1c2784ceaf31a1b2f9433b142a342e8dcdbc3e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:18 -05:00
Johan Hedberg 3f667a45f8 Bluetooth: drivers/h5: Further simplify parsing logic
Move rx state to the h5 struct and use a commmon h5_reset_rx() helper
to reset it.

Change-Id: I92af740ae26b443460531b7200dbb0e64fb11d64
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:17 -05:00
Johan Hedberg 19416fb488 Bluetooth: drivers/h5: Rename 'state' to 'link_state'
Change-Id: Ie188cd34d8006f6c83728bf03cdfc71653c7334a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:17 -05:00
Johan Hedberg c1e49be194 Bluetooth: drivers/h5: Simplify parsing logic
Change-Id: I2a4a4d42329a407a62539a493dfcdaab666231f1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:17 -05:00
Johan Hedberg 20967d3f48 Bluetooth: drivers/h5: Split up h5_unslip_byte() return handling
Change-Id: I2d9a2700e5ac8dfb22ee853adc954a0fe02b8439
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:17 -05:00
Johan Hedberg 9a32952581 Bluetooth: drivers/h5: Remove unnecessary bt_buf_get_sig() helper
Change-Id: I2fd46e325ffba679a0aa27f5b05d4ec9ac67bc13
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:17 -05:00
Johan Hedberg 5559aa13e1 Bluetooth: drivers/h5: Add explicit RECV_RESERVE in Kconfig
Change-Id: Id0957cbe626f54ee167382dab37414467398462d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:17 -05:00
Johan Hedberg d1117f8575 Bluetooth: drivers/h5: Remove unnecessary SIGNAL state
The handling of SIGNAL and PAYLOAD states is exactly the same. Just
remove the other one.

Change-Id: Id82524812919658c6b1df76a7081c826aaf3df34
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:17 -05:00
Johan Hedberg ac35dfa7b2 Bluetooth: drivers/h5: Move h5_set_txwin() closer to the point of usage
Change-Id: I63c4816ec0c7a765be7723c3da82dd165b753fa7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:17 -05:00
Andrei Emeltchenko 3dcb3b8cb4 Bluetooth: h5: Recalculate seq number when retransmitting
When packet is retransmitted we need to recalculate sequence number
since it is not stored in the packet buffer.

Change-Id: Id389fa814e82cfd5e39afba1eaeaa79fc9e337f1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:17 -05:00
Andrei Emeltchenko 276258e647 Bluetooth: h5: Fix memory leaks in case of error condition
In a case of unexpected SLIP_DELIMETER we need to discard remaining
bytes in UART and start from beginning.

Change-Id: Ib13a885cc1a4a188057c587e9974aff1d90594c3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:17 -05:00
Tomasz Bursztyka 86fde21f3b spi: Make the API fully synchronous
The driver has to implement the logic in an interrupt based manner.
Applying the changes to the existing drivers.

Changing ADC's API and implementation as well to follow those changes.

Change-Id: Ie0c3e3e318f619ade6be935adb064a25446cc29c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:17 -05:00
Tomasz Bursztyka c0205c243c adc: Fix a mistake in result buffer handling
The casting was wrong, resulting in setting only on of 2 slots.
Taking the opportunity to make thing a bit cleaner on the header side.

Change-Id: I3aa90b5f251f3c5aa756681425bb8ab07e3da1b5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:17 -05:00
Andrew Boie d9cfbd5a61 interrupts: new static IRQ API
The interrupt API has been redesigned:

- irq_connect() for dynamic interrupts renamed to irq_connect_dynamic().
  It will be used in situations where the new static irq_connect()
  won't work, i.e. the value of arguments can't be computed at build time
- a new API for static interrupts replaces irq_connect(). it is used
  exactly the same way as its dynamic counterpart. The old static irq
  macros will be removed
- Separate stub assembly files are no longer needed as the stubs are now
  generated inline with irq_connect()

ReST documentation updated for the changed API. Some detail about the
IDT in ROM added, and an oblique reference to the internal-only
_irq_handler_set() API removed; we don't talk about internal APIs in
the official documentation.

Change-Id: I280519993da0e0fe671eb537a876f67de33d3cd4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:17 -05:00
Andre Guedes ecfcb6f5e5 i2c: Move general configs to the top of Kconfig
This patch moves the config options I2C_STATUS_DELAY, I2C_CLOCK_SPEED
and I2C_DEBUG to the top of the Kconfig file. These options are
independent of the device driver and should be placed together with
option I2C_INIT_PRIORITY which is also independent.

Change-Id: I2297f4c31c0106a0d80fbaa9b4e5be0488b84732
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-05 20:25:17 -05:00
Andrew Boie 7cb5276158 x86: remove NANO_SOFT_IRQ from zephyr
This was never implemented on ARC/ARM and has been superseded
by irq_offload().

Some checks that were only done with CONFIG_LOAPIC_DEBUG fall
under the category of 'shouldn't ever happen' and have been
converted into assertions, instead of propagating return values
which are largely never checked.

Change-Id: I4eedca05bb7b384c4f3aa41a4f037f221f4a9cfe
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:16 -05:00
Andre Guedes 7b0076a777 rtc: Introduce QMSI RTC device driver
This patch introduces the 'QMSI RTC device driver' which is simply a shim
driver based on RTC driver provided by QMSI BSP.

Some config options are independent of the driver implementation used,
so use a consistent name for them. In this case RTC Interrupt number and
Priority use the same config options for both the QMSI and DesignWare
drivers.

In order to enable this driver, the following options should be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="/path/to/libqmsi/directory"
CONFIG_RTC=y
CONFIG_RTC_QMSI=y

Change-Id: I48292406e5472e5786f3b9abbeb71016a273bfec
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-05 20:25:16 -05:00
Andre Guedes 5c2dfcd53a watchdog: Introduce QMSI watchdog driver
This patch introduces the QMSI watchdog driver which is simply a shim
driver based on watchdog driver provided by QMSI BSP. This driver has
been tested with the latest version of QMSI BSP (1.0.0).

In order to enable this driver, the following options should be set:
CONFIG_QMSI_DRIVERS=y
CONFIG_QMSI_INSTALL_PATH="/path/to/libqmsi/directory"
CONFIG_WATCHDOG=y
CONFIG_WDT_QMSI=y

Change-Id: Id910fa7f8a0559bcd4746747d8ce4588a0c48589
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:16 -05:00
Daniel Leung 7b4167ed78 i2c/i2c_dw: bail out if tx is aborted during send
This enables the driver to process the transmit abort signal
during send.

Change-Id: I3ad1f25669bee214b5e1a04cd858ccb4a8442333
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:16 -05:00
Daniel Leung 0ac7a5b162 i2c/i2c_quark_se_ss: properly process abort during send
This actually makes the code to bail out when transmit is aborted
during send operation.

Change-Id: I3dda7ec4a6e15d1483738bb90d63d674a994903d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:16 -05:00
Daniel Leung 7a5fefbcd8 i2c/i2c_quark_se_ss: extends to do multi-byte read requests
This changes to request bytes that will fill the RX FIFO
instead of requesting byte one-by-one.

Change-Id: I87c6577dc5fcc476284cd3ed0039a178a5221d24
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:16 -05:00
Daniel Leung 61ea58b6cf i2c/i2c_dw: extends to do multi-byte read requests
This changes to request bytes that will fill the RX FIFO
instead of requesting byte one-by-one.

Change-Id: I30696c624c9f828818f6df9f1ee744a5bc515f27
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:16 -05:00
Andrew Boie 2a8843a262 timers: don't build if there is no system clock in use
Change-Id: Ic1463d632562383c3fa0b0b1666a52a0d9a5c4de
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:16 -05:00
Andrew Boie 2295e2abf7 uart: remove uart_irq_get()
This API is not being used for anything, the interrupts for UART
drivers are all being configured statically. Saves code space as
gc-sections can't tell that these APIs are unused.

Some instances where IRQ/priority information was being saved in
data structures and never used fixed.

Change-Id: If56b4fdc251b80be9094ffcbac6f61e265ac2ffd
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:16 -05:00
Andrew Boie cb5022fdba ipm_quark_se: lock irqs while waiting for status bit to clear
Change-Id: Ieb0ac7a32a91826dca39ddb6bec80081c7d2c888
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:15 -05:00
Daniel Leung 32829a9a9b i2c/i2c_dw: tiny improvement to execution flow
() Rolls the transfer initialization function into the setup function,
   as it is logical to have just one function (not to mention there
   was duplicate code).
() The setup function returns early if there is any error.

Change-Id: Ie9d3057f2963a0ba5b74ac66e058ff4fee31f099
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:15 -05:00
Daniel Leung dff5f6a038 i2c: make i2c_transfer() really generic
Make the i2c_transfer() to transact messages through the I2C bus.

It is useful for I2C storage devices, as now we can send one message
containing the destination byte/block address, then send the data
in another message. There is no need to construct one continuous
data buffer to send both address and data anymore.

The drivers and sample apps have been updated to utilize updated
API when appropriate. For i2c_dw, only master mode has been updated.
Slave mode will be updated once we can adequately test it.

Change-Id: I0a811d60567367817fcc8d15f5454e5c933722e2
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:15 -05:00
Daniel Leung ee150853de i2c/i2c_dw: remove unused slave_mode field
It is not being used so remove it.

Change-Id: Ib933cf3cbd62e1f54a4dd0ee7bcba6970e2a29f1
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:15 -05:00
Daniel Leung 0e423317e2 i2c/i2c_quark_se_ss: fix build issue with debugging
Fixes a build issue when CONFIG_I2C_DEBUG is turned on.

Change-Id: I8df72e41d0809f99c9c3855cbfcbc5abc60cbca1
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:15 -05:00
Daniel Leung 05ba788070 quark_d2000_crb: make I2C controller work
There are a few bits missing on enabling I2C controller on
quark_d2000_crb. This adds the missing bits.

Change-Id: I05bbe8367a9e69962db573d496f1f9f0167ba597
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:15 -05:00
Andre Guedes 635351bcdd drivers: Add infrastructure for QMSI drivers
This patch introduces the infrastructure required to enable QMSI drivers.
QMSI drivers are shim drivers based on drivers provided by QMSI BSP. The
BSP provides a static library (libqmsi) which implements several drivers
for peripherals from Intel MCUs.

Next patch will introduce the first QMSI driver (watchdog driver) which
will rely on the infrastructure introduced by this patch.

Change-Id: Ic7da5d0249af0629eef8c91d124a153f84d4a76e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:15 -05:00
Vinicius Costa Gomes 45dcfe1478 rtc: Fix naming of RTC symbols
These symbols have the same name as the symbols from lib QMSI, which
causes a compilation failure, when lib QMSI is used.

This replaces the offending symbols with names which are more consistent
with the rest of the file (rtc_ prefix).

Change-Id: I288a1a229bf0b40f3b6fc8ffb35c502f998054b8
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-02-05 20:25:15 -05:00
Peter Mitsis d63a4f7bf7 nano_timers: Simplify nano_xxx_timer_test() API family
Simplifies the nanokernel timer API so that the timeout parameter must be
specified when invoking nano_isr_timer_test(), nano_fiber_timer_test(),
nano_task_timer_test() and nano_timer_test().

This obsoletes the following APIs:
	nano_fiber_timer_wait()
	nano_task_timer_wait()
	nano_timer_wait()

Note that even the though the new API requires that the timeout parameter
be specified, there are currentl only two acceptable values:
	TICKS_NONE and TICKS_UNLIMITED

Theoretically, the current implementation would allow one to supply a
finite positive value for the timeout and the system would wait up to
that many ticks for the timer to expire. However, it is thought that
that unnecessarily complicates the nanokernel timer model and so it is
left as an unsupported option.  Should that change, then that feature
could be enabled by updating the documentation.

Change-Id: I8835c5342ab5025d6f70fdfbed54a50add7568d7
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:15 -05:00
Peter Mitsis 54b782a88b nano_sema: Simplify nano_xxx_sem_take() API family
Changes the nanokernel semaphore API so that the timeout parameter must be
specified when invoking nano_isr_sem_take(), nano_fiber_sem_take(),
nano_task_sem_take() and nano_sem_take().

This obsoletes the following APIs:
	nano_fiber_sem_take_wait()
	nano_fiber_sem_take_wait_timeout()
	nano_task_sem_take_wait()
	nano_task_sem_take_wait_timeout()
	nano_sem_take_wait()
	nano_sem_take_wait_timeout()

Change-Id: If7a4bce1bd8ec8d6410d04f3c16ff1922ff0910e
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:14 -05:00
Peter Mitsis cd6db374de nano_fifo: Simplify nano_xxx_fifo_get() API family
Changes the nanokernel FIFO API so that the timeout parameter must be
specified when invoking nano_isr_fifo_get(), nano_fiber_fifo_get(),
nano_task_fifo_get() and nano_fifo_get().

This obsoletes the following APIs:
	nano_fiber_fifo_get_wait()
	nano_fiber_fifo_get_wait_timeout()
	nano_task_fifo_get_wait()
	nano_task_fifo_get_wait_timeout()
	nano_fifo_get_wait()
	nano_fifo_get_wait_timeout()

Change-Id: Icbd2909292f1ced0bad8a70a075478536a141ef2
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:14 -05:00
Andrew Boie 4f0f7e3325 ipm_quark_se: don't wait for response with interrupts locked
If the remote handler tries to send a message back with wait enabled
it can lead to a deadlock.

Change-Id: Ife6eae29c10e8937abd1b6511ee605f7786c6a7a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:14 -05:00
Andrew Boie 08d3cd7bfd ipm: quark_se: fix dropped/repeating characters
The while loop on the status bit was unnecessary as we will get
a separate invocation of the ISR for every message. We also ensure
that the global status register bits for the channel being serviced
are cleared before exiting. Fixes an issue where some messages
would be dropped or repeated.

Some runtime checks that shouldn't happen in practice have been moved
to assertions.

Change-Id: Iedd28ae15522c7b9f59ef34fa9fa8b4e24e6be14
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:14 -05:00
Andrew Boie 4d3e120109 ipm_console_receiver: fix carriage returns
It's unclear why the carriage returns were moved to the begnning and
not the end.

Change-Id: Ic6bda55c7537538c47477e6c44f5e4c1534573d4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:14 -05:00
Daniel Leung 760f8798f3 uart/ns16550: implements new API of line control
This implements the newly introduced APIs to manipulate line controls
for UART.

This also implements the driver command API as setting baud rate
may require setting the DLF.

Change-Id: I80634aa3fbd4a3223c46edb61417123e36f439dd
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:14 -05:00
Daniel Leung 64cba6d9c7 serial/uart: adds new APIs for serial line control
This adds 2 new APIs to the serial/uart drivers:
() One is to control the serial line, such as RTS and CTS.
() Another one is to allow driver to expose hardware specific functions
   to apps. This is needed as some hardware may have extra registers to
   set for baud rate.

To keep the code size small, these features are disabled by default.

Change-Id: I15c000ce68a0a490dcfd3493b2fe9bc51fa974fa
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:14 -05:00
Daniel Leung b85d3ef826 uart: move baud rate and options into driver data
This moves the baud rate and options fields out of the UART driver
config struct and into the driver data struct. This will allow
changing baud rate and options at runtime in the future.

Change-Id: I62ddea2f95e634f2d60eeb9537f960799fc9301f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:14 -05:00
Daniel Leung b9c70ce76a uart/ns16550: support divisor latch fraction (DLF)
The UART on Quark SE and D2000 supports fractional clock divider.
It is used to limit frequency error for supported baud rates.

Change-Id: I1f39a95db09f4a5a4116edc700a10e4b9ecfa2bd
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:14 -05:00
Peter Mitsis aad3ba5134 arc timer: Fix tickless idle tick announcement
Change-Id: Iad6806c7be76661987652a63deb70a740c0d8e15
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:13 -05:00
Peter Mitsis 9cfd0de410 arc: add nanokernel tickless idle support in timer0 driver
Change-Id: Id2ee328458c5a1be944e90c34bbc2158464be325
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:13 -05:00
Peter Mitsis c100aa825f arc: Remove misleading comment in Timer0 driver
Change-Id: I42051af9503272b3b7a4dd7dfaf66ae7eb38c133
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:13 -05:00
Javier B Perez Hernandez 02812f4635 drivers: pci: struct pci_dev_info rename class
Rename class in pci_dev_info struct to allow to use C++ compilers.
Updated drivers to use new struct.

Change-Id: I17b94cb7bc094bccd615c8389a28589bfa90cab8
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
2016-02-05 20:25:12 -05:00
Ido Yariv fdf494fa46 pci: add support for 64-bit BARs
Even though the OS is 32-bit, 64-bit BARs can still be mapped into
32-bit address space.

64-bit BARs occupy two entries instead of one, so the offset of a BAR
isn't necessarily its index multiplied by 4. To cope with that, hold an
extra offset field in the lookup structure.

Only 3 bits are required for index as well as the offset since the there
are up to 6 BARs.

Change-Id: I0d4955a3aca70b7fc81a1df06ab5f9f45793c70f
Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
2016-02-05 20:25:12 -05:00
Ido Yariv 77e7b0f66d i2c/dw: add missing PCI device information
The PCI device information for both i2c ports is missing, resulting in
broken PCI enumeration.

Fix this by adding the missing PCI device information.

Change-Id: I5d1739cc994491c34a2a938166a9e56a082ed32e
Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
2016-02-05 20:25:12 -05:00
Ido Yariv e77df3fa30 pci: re-initialize the lookup device for each bus
The current scan loop does not re-initialize the device number, so only
the first bus is scanned.

Change-Id: I9dc97cecd5652c353b09ab5692f59f562436f902
Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
2016-02-05 20:25:12 -05:00
Ido Yariv e4ddf68561 serial/ns16550: scan pci on the second port
Only the first port is currently enumerated on the PCI bus. As a result,
the second port configuration will be set based on the default options,
that may be invalid on some platforms.

Fix this by enumerating the second port as well.

Change-Id: I63733a1f13f7cb35cae1dba3b6192dcd61c9f644
Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
2016-02-05 20:25:12 -05:00
Dirk Brandewie 0551ee0708 ipm: rework isr to service one set of requests at a time
Change-Id: I50604748cee1aeb43dc764f426d3a17fcc943cbe
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz 1fcbd09d88 adc: simplifies Kconfig options for adc dw driver
Change-Id: I1acda668cf10fa58944e57a957f6cf057a1188be
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz 11d2e57f90 adc: improves buffer management to hold repetitive reads.
ADC allows to program repetitives sampling after a read request.
User should be able to provide buffers for each table entry that can
hold subsequente repetitive samples.

Change-Id: I75da4a480a0e3f241d9276cf4fe3999a9cfbba2c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz 69b124dab9 adc: fixes interrupt lines' issue.
Change-Id: I7660a6cb709dcd0237c41c8719152a97bc808980
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz 42696ca14f adc: simplifies buffer management on adc dw driver.
Buffer management on dw driver was too complex.
New buffer management follows the following behavior.
- Each sequence entry have one sample at a time.
- Each sequence entry have a buffer to store that sample.
- If ADC have repetitive sampling configuration, the buffer value
  is overwritten with the new value.

New buffer management allow us to remove Synposys'
files and license headers as well.

Change-Id: I75bbbee59bea400839bb34ca1fcb2111073f99d0
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz 6a4d1b52de gpio: Fixes interruption connection parameters.
Fixes interruption connection parameters, ISR parameter is not null anymore.
Removes irq_connect call that is a dynamic irq api that should not be
used along static irq api: IRQ_CONNECT_STATIC and IRQ_CONFIG.

Change-Id: I232c8562d2dcda3229776b561e2c1f4608a31cdd
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Juan Manuel Cruz 609d1f72a2 gpio: adds interruption masking for quark se ss
The current gpio_dw_initialize implementation masks the interruptions in the line
dw_write(base_addr, INTMASK, ~(0)) to assign api functions and initialize
interrupt vectors and handlers safely. Immediately after this, the driver expects
that gpio_dw_unmask_int(port) unmasks the interrupts. Without this patch that
implementation is empty for the quark se ss board.

Change-Id: Iac84c8807fcadad8c256c3fcaa4ff624b6337bf3
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:25:12 -05:00
Anas Nashif 16bf5fc116 i2c: remove unused functions i2c_dw_memory_read/i2c_dw_memory_write
Change-Id: I3af2038820e2eeaf159b608be1a61fe6adb95c36
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:12 -05:00
Anas Nashif 81ed24413e pcal9535a: remove unused function _wait_10ms
Change-Id: Ib89ec98279895f1d25c4232bed6caf3a1ad83b2b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:12 -05:00
Anas Nashif 78a566d3b8 trivial: fix header guard definition
Change-Id: Ia0090ff07a8f2cab8c745b4f6a0d9eeead5518a2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif 6bca3724c1 drivers: set default priority for drivers
Use a default priority to avoid Kconfig blocking when priority
is not set in SoC or Board.

Change-Id: I4edda47b955a7ee834f04dc40d0decbd8dee6305
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Daniel Leung 6604381c11 drivers: add new DesignWare PWM driver
This adds a driver to utilize the DesignWare timer IP block
to do PWM.

Change-Id: I11ba689350b664209ad2440e3001e57eb38fd982
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif 10bb38c186 Use SoC instead of platform.
Change terminology and use SoC instead of platform. An SoC provides
features and default configurations available with an SoC. A board
implements the SoC and adds more features and IP block specific to the
board to extend the SoC functionality such as sensors and debugging
features.

Change-Id: I15e8d78a6d4ecd5cfb3bc25ced9ba77e5ea1122f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif dcf046c72d rename basic_atom with minnowboard
Use a real board name that can run this kernel instead of a generic
name. Basic functionality exits on this board with Zephyr.

Setup of the board is mostly similar to what we have in galileo (EFI
based)

Change-Id: Ic8554f26dcac0dbbbb6d35d863482f6207dc63c5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif 220c54818c globally include headers for boards and platforms
Change-Id: I1f259cccc73dfb3d35019d6ebf3d3bdc6aec2b23
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif b04958a006 platforms: introduce Quark X1000 SoC
The Galileo board is based on the X1000 SoC, so move galileo to
boards and create this SoC instead, inheriting all SoC related code
and configuration items.

Change-Id: I9b39f1b44644775ee48acae284b82bae7876fffb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:10 -05:00
Anas Nashif a62e16357c pinmux: enable pinmuxing for quark platforms
Change-Id: I66f2aed31d2cb5e087a52b1133663463e9277ab5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:10 -05:00
Andrei Emeltchenko 9b7fecc86b Bluetooth: h5: Fix clearing unack packet queue
Using number_removed to find out how many packets from unack queue we
need to clear.

Change-Id: Icad948892f3ab1febc939e9ba6d6b3431973633e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:09 -05:00
Andrei Emeltchenko 960e1380b2 Bluetooth: h5: Drop out of sync packet
We might get out of sync packet because of race collision, drop it.

Change-Id: Ic84a760199df1520dc7a95383972f9ec428c7fde
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:09 -05:00
Andrei Emeltchenko cad8ca1025 Bluetooth: Refactoring parsing H5 signalling
Add paring sync_req and conf_req and handling transmit sliding window.

Change-Id: I05827ff81d0bb726e72efec3c7cde161259a10c4
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:09 -05:00
Andrei Emeltchenko 8ded073b6c Bluetooth: Cleanup H5 driver code
Rename functions to indicate static ones

Change-Id: Ie1f58baf9875c0ce606ce2c3cd0704057a7f8223
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:09 -05:00
Johan Hedberg 7be985d507 Bluetooth: h5: Fix coding style issues
Change-Id: Ieb25575ed3ef2bb7439531a95e12a7e65eee3d96
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:08 -05:00
Andrei Emeltchenko 841f7c120f Bluetooth: Add stack analysis for H5 UART driver
Analyze stack when sending single ACK packet.

Change-Id: Ifd3a54f0d1ad9a644363563fa9b8bea05b895fa9
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:08 -05:00
Andrei Emeltchenko 3a415c6bfb Bluetooth: Add unacked queue re-queueing
Change-Id: I2a12e6db72046d5ebc78c932ab5054eadbb4308c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:08 -05:00
Andrei Emeltchenko 950078b36d Bluetooth: Improve debug for H5 UART driver
Change-Id: I371717d24ff24ab84871b8f29f365e8a65c74832
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:08 -05:00
Andrei Emeltchenko 3663d11a6d Bluetooth: h5: Add initial retransmission support
Reuse delayed fiber start stack

Change-Id: I739efbeebca15ed27c2874c6f56da99f514bbce9
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:08 -05:00
Andrei Emeltchenko 53543c5f6d Bluetooth: Sending ACK packet using delayed fiber method
If there is no packet to be sent after timeout we have to send ACK for
last received packet.

Change-Id: I30bbc4ae1a257f9a7351dc5a5d2f1269740ce447
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:08 -05:00
Andrei Emeltchenko 379ae2d043 Bluetooth: Add three-wire (H5) uart driver
Add initial code for three-wire (H5) Bluetooth uart driver.
At the moment the driver is EXPERIMENTAL. To test use following
method with qemu:

Run btproxy with three-wire emulation patches:
$ sudo tools/btproxy -d --pty -3
Opening pseudoterminal
New pts created: /dev/pts/21
Opening user channel for hci0

Notice that new device created: /dev/pts/21, use it with qemu -serial
parameter.

Run qemu target with following parameters:
$ make qemu 'QEMU_EXTRA_FLAGS=-serial /dev/pts/21'

Change-Id: I51579ffd8088583df9106689a03b2a0b4aa9e4cb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:08 -05:00
Andrei Emeltchenko e28c5cecd0 Bluetooth: trivial: Correct style
Remove extra line and correct style according to common style.

Change-Id: I5fc9434edce44e52b51fc40866638c0899985b1b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:08 -05:00
Andrei Emeltchenko a8c042827a Bluetooth: Correct headroom calc for outgoing packet
Needed headroom depends on type of the UART driver, change it
accordingly.

Change-Id: Ic9bf5f08a49be6823fce5eff8139d5f949b313ca
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:07 -05:00
Andrei Emeltchenko 2e97cbc55b Bluetooth: trivial style correction
Change-Id: Ib9069e2698614a3f5bb4bc9382aa5d458f007d95
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:07 -05:00
Johan Hedberg 5d80ae929c Bluetooth: Rename NO_DRV to more consistent NO_DRIVER
Change-Id: I30b89607446c9a9926411b5fb210460d076369b1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:07 -05:00
Johan Hedberg b9c8afb353 Bluetooth: Rename DEBUG_UART to more generic DEBUG_DRIVER
Change-Id: I6a47f7579be233d1bcdf01dc9af57f6da62ef75c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:07 -05:00
Johan Hedberg 486167fdee Bluetooth: Kconfig: Remove redundant dependencies
Change-Id: I41013cbea2ec78157b9c5551c3aabecc2daa24a1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:06 -05:00
Anas Nashif 8704792c45 grove_lcd: this display is not a feature of the board
The LCD display is an add-on, not a feature of the platform or the
board.
Set the defaults and remove the definition from Galileo Kconfig.

Change-Id: Ic319cd765d2dc1fe08cc65615680821fe9bc6a83
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:06 -05:00
Daniel Leung 5aab5ccbad arc/quark_se_ss: need some magic to enable GPIO interrupts
1. Need to unmask interrupts for the sensor subsystem.
2. The GPIO controllers need their clock enabled before they can
   start sending out interrupts.
3. Setting up ISR on ARC requires usage of irq_connect().

Change-Id: I633b07292f11e5c5e768fc51fabb70769d407609
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:06 -05:00
Daniel Leung b90cb66afd grove/lcd: add an option to specify I2C master
Add an option to specify to which I2C master the Grove LCD
is connected, instead of already using the i2c_dw driver
port #0.

Change-Id: I4e61ef8e31c75ae912e2d16f8939369c0b8bbc2c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:06 -05:00
Daniel Leung 8a3273aeb6 arm/fsl_frdm_k64f: serial/uart_k20: rework UART clock gating
The code to poke the system integration module to disable clock gating
for UARTs only works for UART0-3 since all the bits are in the same
register. However, clocks for UART4 and UART5 are controlled by
another register. This means that we have been writing to the wrong
bit for enabling UART4.

This patch fixes this issue, and moves the clock gating clock into
board initialization. The incorrect code has also been removed to
prevent accidental mis-use. The dev_data struct is no longer needed
for uart_k20, so that is removed as well.

Change-Id: I67845a417e43647bf0ffcbdbda34ce68fa887713
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:06 -05:00
Johan Hedberg 8683dc4836 drivers/console: Add support for ANSI sequences with values
ANSI sequences may have a numbered prefix which means that the action
needs to be taken the number amount of times, e.g. "Esc[ValueA" (move
cursor forward Value number of characters). Some ANSI commands also
have two preceding values, such as Esc[Line;ColumnH (move cursor to
Line & Column).

To support these ANSI sequences we need to track a bit of extra state,
most conveniently done using a bit field. Since the ANSI parsing logic
gets a bit long at this point it's refactored into its own handle_ansi()
function.

Change-Id: I0711f869d5324f9f827915fde468fe470e7689ed
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:06 -05:00
Johan Hedberg ceba31ade4 drivers/console: Use cursor save/restore escape sequences
Instead of keeping track how many characters we need to move back to
get to the original position, take advantage of the save/restore
escape sequences. This allows us to drop the extra 'i' variable from
both insert_char() as well as del_char().

Change-Id: I69a2b5ea12ec2a7a2e4d519b55e4c737b5d5d25a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:06 -05:00
Andrew Boie 999e706dba mvic: fix how local interrupts are programmed
MVIC has only one local interrupt: the timer IRQ. What IRQ line
to use is not fixed, instead it is programmed into the LVTTIMER
register. This is unlike LOAPIC which has a fixed IRQ for the timer
and instead the *vector* to use for it is programmed into LVTTIMER.

We don't want _loapic_int_vec_set() to do anything as the relationship
between IRQ lines and vectors is fixed and we do not want to be
programming vector numbers into bits 0-3 of LVTTIMER.

The IRQ line to use for timer interrupts is programmed into LVTTIMER
when the MVIC is initialized.

Change-Id: Icba0429f65ece7541fa8542814a8fdc39ad43936
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:05 -05:00
Andrew Boie 88808f1247 quark_se: apic: work around EOI forwarding issue
Quark SE Lakemont core has a hardware bug where the LOAPIC does
not properly notify the IOAPIC to clear the IRR bit for level-
triggered interrupts.

This patch introduces a workaround where the vector ID of the
in-service interrupt is manually written to the IOAPIC_EOI
register, resulting in the bit being cleared.

Unfortunately, in the context where EOI happens it's very difficult
to identify which IRQ line is being serviced, so this is done
unconditionally for all interrupts vectors whether they are registered
in the IOAPIC RTE table or not.

Change-Id: I639cd258dec4f50934e17eadbb821e6a7112e636
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:05 -05:00
Daniel Leung 9e9922265e serial: simplify interrupt config options
Instead of having two config options to specify interrupt triggering
conditions, merge them into one option and clarify. This is now
similar to other drivers which have interrupt triggers.

Change-Id: I4e60c8c45a08d005dcc8256cb89e4c5be7c94307
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:05 -05:00
Daniel Leung c71dddb2c2 spi: dw: intel: move IOAPIC interrupt trigger flags into driver
Move the common #define for IOAPIC interrupt trigger flags out of
platform board.h and into the driver.

Change-Id: I89090181acb5f48dd797e7773ab65c5f3d46c42a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:05 -05:00
Daniel Leung 8effb4fed3 shared_irq: move IOAPIC interrupt trigger flags into driver
Move the common #define for IOAPIC interrupt trigger flags out of
platform board.h and into the driver.

Change-Id: Ie7262b69226ebffa7e1b9e35725fda24b3fe089f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:04 -05:00
Daniel Leung 66b99d9cc1 i2c/dw: move IOAPIC interrupt trigger flags into driver
Move the common #define for IOAPIC interrupt trigger flags out of
platform board.h and into the driver.

Change-Id: I2d50457a45fae62ff085f7239712d580243253bb
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:04 -05:00
Daniel Leung 8cb01064f6 gpio/dw: move IOAPIC interrupt trigger flags into driver
Move the common #define for IOAPIC interrupt trigger flags out of
platform board.h and into the driver.

Change-Id: Ia0a069464392714f38037841de52e8d265fa4f49
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:04 -05:00
Daniel Leung a56ed39825 i2c/i2c_quark_se_ss: fix build errors
Change-Id: I21f09c32f080aea06d65097549327489a81b57ba
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:04 -05:00
Andrew Boie c25d6c5d63 loapic: handle spurious interrupts
A special situation may occur when a processor raises its task
priority to be greater than or equal to the level of the
interrupt for which the processor INTR signal is currently
being asserted. If at the time the INTA cycle is issued, the
interrupt that was to be dispensed has become masked (programmed
by software), the local APIC will deliver a spurious-interrupt
vector. Dispensing the spurious-interrupt vector does not affect
the ISR, so the handler for this vector should return without an EOI.

Change-Id: I4cf4744bd6efd68b72e2c380269de4181dc80bd9
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:04 -05:00
Andrew Boie a0e427f8a4 x86: remove loapic_int_vec_trigger()
This was only needed for an older implementation of software interrupts,
now superseded by the irq_offload() API (which doesn't interact with
the interrupt controller at all)

Change-Id: I8aa696d370ae1799872f6d70de69f3cb5b47456a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:04 -05:00
Andrew Boie 3589695508 ipi: rename to ipm
To many people, IPI connotes inter-processor interrupts on SMP
systems. Rename this to IPM, or Inter-Processor Mailboxes.

Change-Id: I032815e23c69a8297c0a43992132441c240fb71e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:25:04 -05:00
Anas Nashif f6f81868f8 build: Remove PROJECTINCLUDE from application makefiles
PROJECTINCLUDE is not required in app makefiles.

Change-Id: I3751b7c51c453dfe47d207bb11d171138668c4e7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:04 -05:00
Anas Nashif cf81e1ff87 gpio: gpio_dw_registers.h is local to the file including it
Change-Id: I501a6fd2239511d46236fade47fc41d69093471d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:04 -05:00
Dirk Brandewie 88ce5bc8f5 kernel: remove CONFIG_INT_LATENCY_BENCHMARK fences from code path
Add null definitions for the interrupt latency measurement API so we
can remove compile fences in C code.

Change-Id: If86eedf79afcb49002108814dd4fb864956eb667
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:25:04 -05:00
Tomasz Bursztyka ce31c524f2 i2c: Remove all polling based functions
Now that i2c is fully synchronous on top of an interrupt based
implementation, polling mode can be removed. Applying the API change
into the existing drivers.

Change-Id: I05d2a6089743b6b69f7c9da6312057134578e2f7
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:25:03 -05:00
Daniel Leung ff49fa0685 i2c/quark_se_ss: create empty .set_callback()
The i2c_set_callback() does not check for NULL pointers
in driver's API struct. So create an empty set_callback()
function to avoid runtime exceptions, if it is called.

Change-Id: Iad8fed62228d10d42b8189e76873eb4c2ad12eb3
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:03 -05:00
Daniel Leung 77d167d004 ioapic: move common init code into driver
The initialization code and macros are the same. So extracts it
and puts it into the driver. This is another step to follow
the driver model.

Those empty C files are there because the current Kbuild
requires Makefile to be present at those directories,
(due to arch/x86/Kbuild), which requires building some object
files. So the empty source files are there to produce empty
object files to satisfy this.

Change-Id: I14056347ea14cff227d9e8960192e8673c0019b8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:03 -05:00
Daniel Leung 921ee03094 loapic: move common init code into driver
The initialization code and macros are the same. So extracts it
and puts it into the driver. This is another step to follow
the driver model.

Change-Id: I1d379068f64855d5d4595838040ec50f97f638a0
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:03 -05:00
Daniel Leung 8778152298 i8259: move init code into driver
The initialization code and macros are the same. So extracts it
and puts it into the driver. This is another step to follow
the driver model.

Change-Id: I1af8b2888779b2b58367feaff9ee1a6d97b4873c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg a9f6f89e84 drivers/console: Add support for editing the line internally
Add support for forward/backward ANSI sequences and the ability to
enter new text while the cursor is somewhere in the middle of the line
rather than at the end of it. printk is introduced into the game
rather than the old write_uart() since we need to make use of the
%u format string support for creating the ANSI sequence to move
backward/forward the right number of characters.

Change-Id: I41f880fc5de773573147c5a291e2cbe94d5370a4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg f88cccd2b5 drivers/console: Handle basic control characters cleanly
By default, since we don't have special support for control characters
we should simply ignore them. This includes both pure (single) control
characters as well as ANSI escape sequences. The most important
control character to support for basic editing is Backspace.

The terminal creates a Delete (DEL) character by default when
Backspace is pressed. It also treats the Backspace character ('\b') as
a non-destructive backspace. To create the effect of destructive
backspace we have to send the sequence "\b \b".

Change-Id: Idc942d09be2a84b8dd0a60ace8429102c6c7e355
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg 6147fc6384 drivers/console: Ignore characters when runnning out of buffer space
To clean up the logic and prepare for more control character support,
change the behavior so that instead of treating end of buffer as a
forced line break simply stop incrementing the position variable until
getting a carriage return.

Change-Id: Ie3970cb779dac3c826a3d21cf0b9ae57a43eddb2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg 1c35329dc0 drivers/console: Remove unnecessary check for line feed character
The terminal doesn't generate line feed ('\n') when pressing return,
rather only a carriage return, so we can simplify the condition for
handling end of line.

Change-Id: I3eef8c6af19c43ef98ccdd9a5e3662d280834425
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg 5305003b32 Bluetooth: Use h4_* prefix for H:4 driver internal symbols
Now that the HCI driver is called H:4 use the shorter driver-specific
prefix h4_* for its internal symbols.

Change-Id: Icdab1147e5ec31f84e0a3d810192ddd462f4dfdd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg 4bb1391c7d Bluetooth: Rename UART driver to H:4 driver
We'll in the future also have a three-wire UART (H:5) HCI driver, so
the current H:4 driver cannot have a generic name.

Change-Id: Id326ae63d6f4d273d0d0c6120143e2f8d62968d1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Szymon Janc 51f8ca59cd Bluetooth: Add newline to log macros
Make newline part of log macros so that caller doesn't have to
append '\n' every time logs are used. This make sure that no
log will be missing new line which results in concatenated log
messages.

Change-Id: I3231ae747c790816dbc1608e0a3bd56467ba0a1b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:59 -05:00
Daniel Leung 6354e36be7 aio: dw: fix compilation errors
() Fix compilation errors due to variable ordering.
() Fix the default config for Quark/SE SS as
   the kconfig options were renamed in previous
   patches.

Change-Id: I1004ae332fb857b60ed90df59831e7bd9c490cb8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:58 -05:00
Johan Hedberg 6eeec2137f drivers/console: Reduce scope of 'pos' variable
The 'pos' variable is only used within a very limited scope inside the
uart_console_isr() function. Move it's declaration there to avoid
having it exposed to the entire c-file.

Change-Id: I45ff0090ea4e0aabe77db2549d0194e26ebb63ef
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:58 -05:00
Johan Hedberg 5ad78034c9 drivers/console: Remove unnecessary indentation in uart_console_isr
Most of the uart_console_isr() function is heavily indented. We can
remove one level by converting:

	if (uart_irq_rx_ready(uart_console_dev)) {
		...
		...
	}

to:

	if (!uart_irq_rx_ready(uart_console_dev)) {
		continue;
	}

Change-Id: Ib2fe150490a8391de4001f29e4727431668853c4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:58 -05:00
Johan Hedberg 2893def459 drivers/console: shell: Add custom prompt callback support
Shell applications may want to have a dynamic prompt rather than a
fixed string. Add a new API to let the application specify a custom
callback instead of using the fixed string given to shell_init().

Change-Id: I9844481057fc8e164530a677e7cb1bfb6d02cfc0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:58 -05:00
Tomasz Bursztyka 04f5cfb889 wdt: dw: Add support for optional clock gating
Clock gating is platform specific and not mandatory. Thus making it
Kconfig based as well as generic.

Change-Id: I4ea10eadb077ac3d57c9337b43b1a9fb14763302
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:58 -05:00
Tomasz Bursztyka 61c15ba1e1 rtc: dw: Add support for optional clock gating
Clock gating is platform specific and not mandatory. Thus making in
Kconfig based as well as generic.

Change-Id: I01b7831536efd87cc66a95060fcf1faf4a340073
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:58 -05:00
Tomasz Bursztyka d1d66a6200 rtc: dw: Unmasking interrupt is not generic among platforms
Let's apply the interruption unmasking if only the mask is defined.
Which definition should be done in board.h thus applying the change to
quark_se and quark_d2000 platforms

Change-Id: I9c273e2e7e33dd077a54e8f9205fa949a5e3707a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:58 -05:00
Tomasz Bursztyka 49a6e0ae37 wdt: dw: Unmasking interrupt is not generic among platforms
Let's apply the interruption unmasking if only the mask is defined.
Which definition should be done in board.h thus applying the change to
quark_se and quark_d2000 platforms

Change-Id: Ie0a4912f0dfbd97f2273efed963f7810a985c0bd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:58 -05:00
Tomasz Bursztyka 66f05ce4b3 rtc: dw: Make internal primitives Kconfig based
Base address, IRQ, interrupt priority as well as the instance name: all
are now Kconfig based. Thus Applying the change to quark_se and
quark_d2000 platforms. Sample code is updated as well.

Change-Id: I1c225c1b68d94b22ca10423b50a78a0ba09a27a5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:58 -05:00
Tomasz Bursztyka 85b49efe67 watchdog: dw: Make internal primitives Kconfig based
Base address, IRQ, interrupt priority as well as the instance name: all
are now Kconfig based. Thus Applying the change to quark_se and
quark_d2000 platforms. Sample code is updated as well.

Change-Id: Idcc89e6e9f4acc337fafc7d42f8de3061a5ece04
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:58 -05:00
Tomasz Bursztyka 466cb00d3f rtc: Make the API ready for multiple RTC instances
A platform might provide multiple RTC, either internally or externally.
Applying the changes to the DesignWare driver relevantly as well as
to the sample code.

Change-Id: Ia70e791a6c45e186cbc4dc900a268fa882331af5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:58 -05:00
Tomasz Bursztyka e8c4335aa6 watchdog: Make the API ready for multiple WDT instances
A platform might provide multiple watchdogs, either internally or
externally. Applying the changes to the DesignWare driver relevantly as
well as into the sample application.
Taking the opportunity to apply propre style when need (80 chars limit
for instance).

Change-Id: Iad020c697846db483a70a748cfc8fe7147ec3c04
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:58 -05:00
Anas Nashif 275ca60b08 Fixed file description and applied doxygen style
Removed old style file description and documnetation and apply
doxygen synatx.

Change-Id: I3ac9f06d4f574bf3c79c6f6044cec3a7e2f6e4c8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:58 -05:00
Yonattan Louise dc12b5d06a Add _loapic_isr_vector_get to mvic
The kernel event logger requires this function to obtain
the irq that is being processed, but this was not implemented
for mvic. This patch add this function to mvic.

Change-Id: I5e1b4a6e2758b69ec713c18ac9f78aebad18a93f
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:24:57 -05:00
Anas Nashif de40d9f90f uart: check for MVIC when creating stubs
Some systems are configured with CONFIG_MVIC which uses the same
call to create the stub.

Change-Id: I92f6657806159624dee9c271554a78bc76935613
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:57 -05:00
Daniel Leung a0a140f470 uart/nsim: Make config for uart/nsim explicit
This adds CONFIG_UART_NSIM to enable the uart/nsim driver.
This fixes compilation issue where the base address parameter
is not defined due to CONFIG_NSIM=y but CONFIG_SERIAL=n.

Change-Id: I1dc1c15b22ad174d4db514d89551780f0dfcae66
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz 0aa73523dd adc: fixes the macro name for interruption vectors.
Change-Id: I01d939e98e3e4bf4593ded2feb6ff757a46c3d38
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Dmitriy Korovkin dcda679c72 gpio, pwm, rgb lcd: Replace polling i2c requests
Now that i2c_transfer/i2c_read/i2c_write are fully synchronous, no need
to use the polling based function.

Change-Id: Ib578cf4a6d72ad0817e1aaeebc7e4dab9f9d293f
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:57 -05:00
Dmitriy Korovkin 0b95c35549 i2c: Transmission completion semaphore
Add a semaphore. Each task or a fiber that initiates
a transmission waits on this semaphore for it to complete.

Change-Id: Ia6cf961397614ead252ebea3949c016056289311
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz 86a0ab478b adc: kconfig symbols for interruption vectors and priority
Change-Id: I464277dbeae0138702cc78ef43278ce26c8b1a0c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz bc1a79c4c3 irq: removes priority parameter from IRQ_CONFIG macro
Removes the 'priority' parameter from the IRQ_CONFIG macro.
This parameter was not used anymore in any architecture.
The priority is handled in the IRQ_CONNECT macro.
The documentation is updated as well.

Change-Id: I24a293c5e41bd729d5e759113e0c4a8a6a61e0dd
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Daniel Leung 52c08d8965 i2c: i2c_quark_se_ss: fix compilation error
Function irq_connect() needs an extra parameter, so
add it in.

Change-Id: I4c7458e67ae57124228eeb486c8daf3b66a97f8f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:57 -05:00
Juan Manuel Cruz 52e11824ee gpio: Adds io/aux register support for IP configuration.
Adds io/aux register support for IP configuration.
x86 and ARM configure IP through MMIO register access.
ARC architecture configure IP through io/aux register access.

Change-Id: I4d07b91af09d88b7eb6ac1aa02e875dcd626bd26
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:57 -05:00
Daniel Leung 960229468a grove/lcd: fix init level due to dependence on system clock
The Grove LCD driver requires running clock for delay. Since the clock
is only initialized in NANOKERNEL, so change the LCD driver init level
so that it starts after clock is initialized.

Change-Id: I6a2cadac1b34f95557f99c78615b1bd4aee541f5
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung ddab92c23a hpet: move content of include/drivers/hpet.h into driver
The content of include/drivers/hpet.h is really private to
the driver and does not need to be exposed in public include
directory. So move the content into driver code.

Change-Id: Ica442e43c480a6b079b8d3c4e75e67adcfd0ba6b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:56 -05:00
Juan Manuel Cruz 5e5a45e45e gpio: fixes isr signature for static irq
Static irq api expect to have an isr with signature
void isr(void *arg).

This fixes the warning messages due the difference on
the isr parameter.

Change-Id: I64099ce47ba481b40446d5fb7e35fce0e46a9624
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:56 -05:00
Juan Manuel Cruz 46e79a7990 adc: adapts irq static macro calls
Adapts IRQ macro calls for the new IRQ static support convention
on ARC.

The new IRQ_CONNECT macro requires to receive the irq numbers without
parenthesis around. This is needed to execute preprocesor substitution
correctly.

Change-Id: I318cb7916b6c3ff3a92b4d2e5a13379f8eed0b4e
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung ba6f2d9617 uart: remove uart_devs[]
Since all the necessary bits utilizing UART by index have moved to
use device name instead, the uart_devs[] can finally be removed.

Change-Id: Idbae6b46c0af9eef6c22c59e121e9d6a6b52426a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 5cdd4584fe uart_pipe: use device name instead of index
Use device name to find the UART device for uart_pipe usage,
instead of relying on an arbitrary index.

Change-Id: I36aaa4ed8f0b4905e4e741ca1464947e59f30869
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 1720991b81 bluetooth/uart: use device name instead of index
Use device name to find the UART device for Bluetooth usage,
instead of relying on an arbitrary index.

The default device names being used are derived from the original
board.h for each platform. Some of them point to the same device
as UART console. Since this is a Kconfig option, the default
can be overridden so this is not a serious issue.

Change-Id: Ibe82f3968e72ba60f9c033aa3dfcb2fb3c41dc75
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 08b4fd431b console/uart: use device name instead of index
Use device name to find the UART device for console usage, instead of
relying on an arbitrary index.

Change-Id: Iebe01c9bf392dfee6d8284367f67647f7d47561a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 1d816afcc0 serial: remove unused code after refactoring
Remove unused code after refactoring all the serial/UART drivers.

() Since device initialization is done by the drivers themselves,
   there is no need to have config_func(), port_init() and uart_init()
   to perform configuration external to driver. So remove the related
   bits.
() The IRQ priority is only being used when doing IRQ_CONNECT_STATIC().
   So there is no need to send it over during uart_init().

Change-Id: I72eb3402036b53cbc01c1eb968de0ddfa0096ee2
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 9481c75945 serial/stellaris: consolidate initialization code
Since the initialization is now done within driver, there is
no need to expose the port_init() function externally anymore.
After the consumers of port_init() have been updated. It is time
to perform the final step.

Change-Id: Ibe22c6d1dc9525c845acc094fa2066c922439ec3
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 98c6aee8cd serial/k20: consolidate initialization code
Since the initialization is now done within driver, there is
no need to expose the port_init() function externally anymore.
After the consumers of port_init() have been updated. It is time
to perform the final step.

Change-Id: Iba7aeb056edd63ef3f9b47d3801a3e0eeb9b34d5
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 7dbf56bb0e serial/ns16550: consolidate initialization code
Since the initialization is now done within driver, there is
no need to expose the port_init() function externally anymore.
After the consumers of port_init() have been updated. It is time
to perform the final step.

Change-Id: I4e0d0a6802ddda4a6671c6d246233eaa5074d4ff
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 5faca5067a uart_pipe: let UART driver do the initialization
Remove the call to uart_init(), and let the UART drivers take care of
the port initialization.

Change-Id: Id3e46135ab993cb6596b1fb5339ab1664c65ab40
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 3d361603e5 bluetooth/uart: let UART driver do the initialization
Remove the call to uart_init(), and let the UART drivers take care of
the port initialization.

Change-Id: Ibeca65b3fe64feb7a203a793c01c525ff5e6afda
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 91cea2c9a6 serial/nsim: refactor (again) to conform to driver model
() Rename nsim_uart.c to uart_nsim.c. This is to follow
   the driver naming convention.
() Rename functions nsim_uart_*() to uart_nsim_*(),
   following driver naming convention.
() UART ports initialization is moved into the driver itself.
   All the init code in platform config files is removed.
() Adds (many) Kconfig options. These don't have to be defined
   in each platform's board.h anymore.

Change-Id: If015f39a6f6b4fcc65625e6e5f973b4469202f54
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung b541dbdf77 serial/stellaris: refactor (again) to conform to driver model
() Renames stellarisUartDrv.c to uart_stellaris.c. This is to follow
   the driver naming convention.
() Renames functions stellaris_uart_*() to uart_stellaris_*(),
   following driver naming convention.
() Renames CONFIG_STELLARIS_UART* to CONFIG_UART_STELLARIS*
() UART ports initialization is moved into the driver itself.
   All the init code in platform config files is removed.
() Adds (many) Kconfig options. These don't have to be defined
   in each platform's board.h anymore.

Change-Id: I0eadc3878d69ff24d1637f8df5220fd2f161d24f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung d77f6efe03 serial/k20: refactor (again) to conform to driver model
() Rename k20UartDrv.c to uart_k20.c. This is to follow the driver
   naming convention.
() Move driver/serial/k20_uart.h to drivers/serial/uart_k20_priv.h
   as this contains definitions private to the driver, and
   should not be exposed in public include directory.
() Rename functions k20_uart_*() to uart_k20_*(), following
   driver naming convention.
() Renames CONFIG_K20_UART_* to CONFIG_UART_K20_*
() UART ports initialization is moved into the driver itself.
   All the init code in platform config files is removed.
() Adds (many) Kconfig options. These don't have to be defined
   in each platform's board.h anymore.

Change-Id: If1be1fde083aba6ff68062db2059aef08617a286
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Daniel Leung 728d91d598 serial/ns16550: refactor (again) to conform to driver model
() Renames ns16550.c to uart_ns16550.c. This is to follow
   the driver naming convention.
() Renames functions ns16550_uart_*() to uart_ns16550_*(),
   following driver naming convention.
() UART ports initialization is moved into the driver itself.
   All the init code in platform config files is removed.
() Adds (many) Kconfig options. These don't have to be defined
   in each platform's board.h anymore.
() Renames CONFIG_NS16550_* to CONFIG_UART_NS16550_*
() Disable NS16550 for ARC as no port is defined anyway.

Change-Id: I76bbe25b9bc75eb62df81e533f84f4f63a5257b7
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:56 -05:00
Anas Nashif d3d26ab864 drivers: make stubs work with MVIC
Quark D2000 which uses MVIC does not define CONFIG_IOAPIC,
so make the stubs work with MVIC.

Change-Id: If0ef53f16592a7a8a467629cffe976e37b258901
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:55 -05:00
Tomasz Bursztyka 5aebc6cca7 gpio: dw: Remove already defined macro
BIT() is already defined as a generic utility macro in misc/util.h

Change-Id: Ie74bbfe657de5de980439e30b2dcbb9168b69257
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:55 -05:00
Tomasz Bursztyka 8e4aff1079 gpio: dw: Support optional clock gating
This is currently valid for quark_se platform. It's used internally to
suspend and/or resume the gpio controller.

Change-Id: I5147568ba6b0450363566b5f9fd2e8aa7e41df49
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:55 -05:00
Anas Nashif 61d7f11f0f gpio: dw: Support host interrupt mask on Quark SE
Change-Id: Ie58e8611a8fe9edec9ebcb123532a97f396098f4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:55 -05:00
Tomasz Bursztyka 0d61d584f0 gpio: dw: LS_SYNC is a unique bit for the whole controller
There is no such feature per-pin. LS_SYNC is set or unset for the whole
controller.

Change-Id: Ic67048e29a9cc25a19e6a7bcc11d21dd1e65be61
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:55 -05:00
Anas Nashif 48fad1d2cd shell: prefix types with shell_
To be consistent across the API.

Change-Id: I13081ac7d67a7bd2095925239f4431db96cd6242
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:55 -05:00
Thomas Heeley f85566a0b6 misc: add shell support.
Move btshell.h out of samples into include/misc and rename to shell.h

Move btshell.c into driver/console and rename to console_handler_shell.c
as an shell implementation based on new config
CONFIG_CONSOLE_HANDLER_SHELL.

Add shell_register_app_cmd_handler for an to app to optionally call so
that it can receive cmdlines not handled by the cmds registered with
shell_init

Change-Id: I5c1585e62ff7a0ee923c6c92833cc762cf912bad
Signed-off-by: Thomas Heeley <thomas.heeley@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:55 -05:00
Anas Nashif 8bb3dd4e26 replace nano_tick_get_32 with sys_tick_get_32
The calls have been renamed and some drivers and documentation
are still using the old function name.

Change-Id: Ib7505fca6aadd68e3ea3a22bb445914c3eb6ed7f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:55 -05:00
Anas Nashif 2318f02a7a watchdog: rework watchdog timer driver and use sys_io function
Simplify driver by using sys_io functions and implement

 wdt_read_config

Change-Id: I119615f1c391daae43a3b8db30319c51167ae05b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:55 -05:00
Peter Mitsis 53af19050d timer: Remove deprecated routines
Removes the following deprecated routines:
	nano_cycle_get_32()
	task_cycle_get_32()
	fiber_cycle_get_32()
	isr_cycle_get_32()

Those routines have all been replaced by sys_cycle_get_32().

Change-Id: I8709952633bb87c8963e88caffe1036fb9add527
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:55 -05:00
Peter Mitsis 92b21c7153 timer: Rename _sys_clock_cycle_get()
Renames _sys_clock_cycle_get() (provided by the timer driver)
to sys_cycle_get_32().  It is the preferred method to read the
hardware clock.

Change-Id: Ifea5213d8c04a8bf7b9114b048c5db0ccee61549
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:55 -05:00
Anas Nashif bbe94000e4 quark_se_ss: rename platform and remove arc suffix
This platform if actually a subsystem of the Quark SE SoC and is
not standalone. Use a more descriptive name and remove the architecture
from the platform name.

Change-Id: I16b1ab8dd668441683b07fc4512c219924463441
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Anas Nashif 5115fb57ad quark_se: rename platform and remove x86 suffix
Change-Id: I19ac3a4c6081720736c6fbf16b649ccf6ae60e2f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Anas Nashif 2dcb70d264 gpio: Fix parameter of macro
Change-Id: Ie8e4cac475b32e6cceb3904ae535c2fb22789ff4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Dmitriy Korovkin 57f2741e4f init: Implement fine-grained initialization policy
Put initialization priorities as device driver Kconfig
parameter.

Initialization priority value for each platform is defined
in the platform Kconfig file.

Drivers and platform code use SYS_DEFINE_DEVICE to add
and initialization function.

Change-Id: I2f4f3c7370dac02408a1b50a0a1bade8b427a282
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Anas Nashif 1efdcaad47 watchdog: set flags for IRQ_CONNECT_STATIC call
IRQ_CONNECT_STATIC now has the IRQ flags as the sixth parameter.

Change-Id: I680b21c92471e6bcb793598adcd286a73d539ddf
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Anas Nashif 1e3dca51bb build: set platform name without quotes and reuse everywhere
Avoid having to remove quotes wherever the platform name is used
by exporting the variable only once.

Change-Id: I4cb51901e4ac19d70d0310fe6bbacd157f586661
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Anas Nashif b4edcb80cc rtc: set flags for IRQ_CONNECT_STATIC call
IRQ_CONNECT_STATIC now has the IRQ flags as the sixth parameter.

Change-Id: Ib3efe15a128d74b84d83df3f8aeb39cdcea5ee41
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Anas Nashif fe218157b3 uart pipe: do not override objects in Makefile
uart_pipe when enabled was overriding all previous objects.

Change-Id: I5620b56dc7e42f887a7b78e07470e729a266d5f7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Peter Mitsis c40e84c57a nanokernel: Rename nano_tick_xxx APIs
Renames the following nanokernel tick APIs.
	nano_tick_get()      -> sys_tick_get()
	nano_tick_get_32()   -> sys_tick_get_32()
	nano_tick_delta()    -> sys_tick_delta()
	nano_tick_delta_32() -> sys_tick_delta_32()

Change-Id: Ie969545335d76df94b4e2d200fef86a93596f5e8
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:53 -05:00
Benjamin Walsh bb94fbfd1f hpet: set sys_clock_hw_cycles_per_sec at runtime
The HPET reads its frequency at runtime, and thus must set all relevant
global constant values at runtime as well.

Change-Id: I965102bbdcea370297d5a2bbe14177ec0d0d3794
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:53 -05:00
Benjamin Walsh fcc2017563 timers: fix indentation in Kconfig
Change-Id: I917690b83d5ef85e338487e489423bda614eaac3
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:53 -05:00
Benjamin Walsh fde6458f0b sys_clock: add option for setting timer frequency at runtime
Some timer devices, such as the HPET, read their frequencies at runtime.
All global constant values must be set at runtime in that case.

Change-Id: I408babce6deb857748a87691132d7e27e88f0bb8
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:53 -05:00
Anas Nashif 77ba3c3b8b kconfig: define architecture as a kconfig variable
Do not depend on environment variables and use a kconfig variable
for defining the architecture.

In addition, remove the X86_32 variable, it just duplicates X86 for
not good reason, at least until start supporting MCUs with 64bit.

Change-Id: Ia001db81ed007e6a43f34506fed9be1345b88a4b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:52 -05:00
Tomasz Bursztyka 7c0155acd3 i2c: dw: Fix support for i2c port 1
- Provide the irq flags to IRQ_CONNECT_STATIC
- Provide the actual IRQ for that controller

Change-Id: If660baca7e92065cfdb588a2ae86ff13da0918eb
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:52 -05:00
Tomasz Bursztyka 14267b85c9 spi: dw: Fix various building and support issues
- Build the actual driver when relevant
- Provide the IOAPIC stub
- Provide the IRQ flags for IRQ_CONNECT_STATIC
- Set the default IRQ priorities

Change-Id: Iea20ef67c92cf7f48791fba5a8021448b7059950
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:52 -05:00
Tomasz Bursztyka d47f91893d gpio: dw: Fix build error when configuring dw driver with direct IRQ
SYS_GET_DEVICE() needs the name set in DECLARE_DEVICE_INIT_CONFIG() not
the one in IRQ_CONNECT_STATIC().

Change-Id: Id1ed66953c863531411b34594ffed669ad524ef5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:52 -05:00
Tomasz Bursztyka 8ae3b9d2d4 gpio: dw: Provide IRQ flags for GPIO 1
That fixes a build error. Platfom's board.h have to provide such flags
if they enable dw gpio 1 controller.
Take the opportunity to provide the right isr to IRQ_CONNECT_STATIC.

Change-Id: I16900ea04f7f7c5d3c99b93a92b00c1f651494de
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:52 -05:00
Szymon Janc c0baad2262 Rename simple UART driver to pipe UART
Original name was too generic and confusing. This patch renames
driver to pipe UART and moves it to console drivers folder. Kconfig
destription is also improved.

Change-Id: I716fdbf7d636bbdc03b0fce27a59fd866f473246
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:52 -05:00
Anas Nashif ac1f343c9a timer: Support for no local Apic Timer divider
Change-Id: Ic9c167761e31233e821da364121c01f3971a8f13
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 7625b098b9 MVIC: handle boards with fixed IRQ to vector mapping
Change-Id: I319bc2a18310a6a6808fced3e142640e225236d2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 00c4d32d42 x86: add Quark D2000 Interrupt Controller (MVIC)
This module is based on the standard Local APIC and IO APIC source modules.

This modules combines these modules into one source module that exports the
same APIs defined by the Local APIC and IO APIC header modules. These
routine have been adapted for the Quark D2000 Interrupt Controller which has
a cutdown implementation of the Local APIC & IO APIC register sets.

Change-Id: Ic80aa78918483663d76054ebadefa08d8a3f188a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Juan Manuel Cruz 59cb73520a gpio: adds gpio dw register support for ss quark se
Adds the register definition for the DW GPIO hardware block.
This set of registers and offsets are specific for the SS
GPIO hardware block in the Quark SE platform.
In particular, the register BOTHEDGE (offset 0x68 in the
main GPIO block) does not exist on the SS GPIO block.

Change-Id: I4e16ec7c8e89015be1fc8bcdb1b7fa5377890b9d
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:48 -05:00
Daniel Leung c6d527bc4b i2c: Add I2C driver for Quark SE Sensor Subsystem
This adds the I2C driver for the Sensor Subsystem on Quark SE.
This provides minimal support for the I2C controller, and does
only synchronous transfer at the moment.

Change-Id: I400b8ff3390d4b641bed5b8c617830c4217de3ff
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:48 -05:00
Juan Manuel Cruz a24b7a8895 adc: add DesignWare ADC driver
This commit adds the Synopsys source code for the arc ADC driver.

Change-Id: I140a63505685cda8ec9d3174b7cf4fc1e2e91b06
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:48 -05:00
Daniel Leung a789cc0c02 aio: introduce DesignWare AIO/Comparator driver
This adds the driver to support DesignWare AIO/Comparator
under drivers/aio.

Change-Id: Id6cb1b507c0526098f163f74c188e990590797c2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Tomasz Bursztyka f7a6c5c263 spi: Add support for Designware SPI controller
Such controller is found on Quark SE Lakemont and ARC cores. This
driver currently supports the Lakemont core (x86).

Change-Id: Iefebd6ce9dbe81aa3902e7c2d801b07c027c548a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:48 -05:00
Andrew Boie 3937f84c9f IPI: Implement Quark SE mailbox interface
Implements a low-level IPI driver for Quark SE mailboxes.
Configures the Quark SE platform to initialize it and
configure an IPI console from ARC->LMT on channel 4.

Change-Id: I30123771d04c2e06ea6fcca585fd4ef74c0717a7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Tomasz Bursztyka 714dd9786b clock: add Quark SE clock control
Quark SE provides various clock controllers through its SCSS block.
Peripheral, external, sensor, and others.

This current drivers provides only the clock gating capability, for
peripheral, external and sensor. But it could support divider and more
other features once defined in the generic API.

Note: such clock has _nothing_ to do with a Real Time Clock (RTC).
An RTC provide clock timing like a watch would do. Here the clock
controller is about circuit clocking.

Change-Id: I1a365ae730dfc6be7686271f7fbb693e64a6ff6f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif a9ed4ba9f5 watchdog: add DesignWare watchdog driver
Driver is used on Quark SE and Quark D2000.

Change-Id: I46b685a8886e86e2fa4071304713a73a7d2e4c96
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 9d6deb4e8c rtc: add DesignWare RTC driver
Adding DW real time clock support. This driver is used by the Quark SE
and Quark D2000 SoCs.

Change-Id: Iba8ddee1b1b5fee298db95b63418e152774662a4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Daniel Leung d3d64ca4cf bluetooth/uart: register driver at boot if enabled
The driver should handle the initialization instead of relying on
platform initialization. This is to conform to the driver model.

Change-Id: Idc95d59bce2470b5118e416ee05f07548991a15c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 4378eae1d3 gpio: fix inclusion of local header
since we are in the same directory, include the file directly.

Change-Id: I21c959538e4a3d9e3fba99eaa9b09697fffe25b0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 9f30c4a8b5 adc: fix inclusion of local header
since we are in the same directory, include the file directly.

Change-Id: I8c676e1e5acd7dbab2c283d914a3ef62c2d36cdc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Dan Kalowsky 2028db6399 i2c : re-naming interrupt_vector to irq_num
Changing the ROM struct's interrupt_vector to reflect
what the value is properly referencing.

Change-Id: Ifb284821e82e01123c51a848d694da19e442c1e8
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:48 -05:00
Peter Mitsis 5c39418ae8 k20uart: Fix check for Rx/Tx irq
Due to a quirk of the k20 UART, when checking if either a Tx or Rx
irq is ready, one must first check whether the UART has enabled the
Tx and/or Rx interrupts.  If this is not done, then all one is doing
is testing the UART to determine if it is ready to Tx and/or Rx.

Change-Id: I08a8280ed9fb0faef586f3c7d7befb3bfdec1e2d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:47 -05:00
Jukka Rissanen 2272312b8d net: Refactor code to use new generic net_buf API
Change-Id: Id008bbf43062ca0641a76edaabef47c650287444
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:46 -05:00
Johan Hedberg 72e3b3fdb2 Bluetooth: uart: Simplify bt_uart_discard() with the help of min()
There's no need to do manual minumum calculation when there's the
min() helper available.

Change-Id: I4d5cfb088d9e6499750664680419ab4beb56e0d5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:45 -05:00
Johan Hedberg 1d92308078 Bluetooth: uart: Simplify send callback logic
We can remove the need for the extra 1-byte headroom by simply
directly writing the H:4 header with uart_poll_out(). Also the
separate uart_out() function can be removed by taking advantage of the
counters already present in the net_buf.

Change-Id: I54bd852e28f416b3de250cd9f8a126269cccfc14
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:45 -05:00
Johan Hedberg 1f6841c9c1 Bluetooth: Convert driver header info to hidden Kconfig options
We know the needed values at build-time, so there's no point in having
a runtime mechanism of accessing them in the code. Having the values
as defines makes it e.g. possible to use them as input for defining
the size of buffer pools.

Change-Id: Ib7556644719bfb631e638fa5bf29f3d1747a5072
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:45 -05:00
Johan Hedberg 3cae902928 Bluetooth: Make HCI driver send() consume the given buffer
It is more intuitive to assume that the driver send() consumes (takes
ownership) of the buffer given to it.

Change-Id: I53d9cbebc0564d1d11110fc78a62ce0bbb3cdfd2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:44 -05:00
Dmitriy Korovkin f1420515a7 irq: Add flags to IRQ_CONNECT_STATIC() macro and irq_connect() function
Flags allow passing IRQ triggering option for x86 architecture.
Each platform defines flags for a particular device and then
device driver uses them when registers the interrupt handler.

The change in API means that device drivers and sample
applications need to use the new API.

IRQ triggering configuration is now handled by device drivers
by using flags passed to interrupt registering API:
IRQ_CONNECT_STATIC() or irq_connect()

Change-Id: Ibc4312ea2b4032a2efc5b913c6389f780a2a11d1
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:44 -05:00
Dan Kalowsky 4a61c2824b i2c: adding in support for I2C1
Somehow through the process of enabling Galileo, we have partially lost
the functionality needed to enable I2C1.  Bringing back the I2C
configuration options for I2C1 to the DW IP block.

Change-Id: I296bd9c3d167969df5b2fe17627633f5ec4b1ba4
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka 4effd20617 gpio: Add a driver for Intel's SCH controller
Such controller is found in legacy bridge on Intel's platforms. Such as
Poulsbo or Quark x1000.

Change-Id: I30f205f1e73aaa680092e92717fdacbb74046fa3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka 72a26b5a38 gpio: mmio: Use i/o port bit operations functions
Now make use of sys_io_clear_bit and sys_io_set_bit

Change-Id: I11ebcd8c31d2a4c6d3dac37a0eca0ffcfacead61
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka dc6a584650 gpio: dw: The callback should tell about the GPIO pin
A tiny fix where the pin is the bit position, not its mask.

Change-Id: I4ed8c4b2968ff28b407cab88903351bafe6501ba
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Peter Mitsis 067ed49efc k20UartDrv: Fix k20_uart_fifo_read()
Fixes the logic in the routine k20_uart_fifo_read() so that it reads the
data from UART if the status register 1 indicates that data is available.

Change-Id: I1722b013e05c7477587c07f5a0b90c753ba34aab
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Peter Mitsis 3f97f24b33 adc: Fix dependencies
The ADC implementation requires that the kconfig option NANO_TIMEOUTS be
enabled as it uses the routine fiber_delayed_start().

Change-Id: Iec49fec4badd3fcf173a2d2cc9d2924299190150
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Peter Mitsis c7a76a226d galileo: Fix SPI speed and configuration values
Change-Id: If15b2931e00d3a5748a56cea673e694389a7e963
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Johan Kruger 7a9fa51b61 pwm: Changes to PWM driver for the PCA9685.
- Changed behavior of duty cycle to have the signal ON time as the
  duty percentage instead off the off time. Note however, this requires
  that the off time is controlled. The behavior seems to be inverse of
  what the user will expect on the header IO.

Change-Id: I1e7abf0324509de375d545a0215fd1edf2283814
Work-by: Johan Kruger <johan.kruger@windriver.com>
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Benjamin Walsh 1e60ee31bc timer: allow enabling of sys_clock_disable()
Create the SYSTEM_CLOCK_DISABLE configuration option.

Change-Id: I9174fa2758988240d0850233146bb1e1d37a07c3
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:43 -05:00
Benjamin Walsh ac1148e1de timer: rename SYSTEM_TIMER_DISABLE/timer_disable
Rename them to SYSTEM_CLOCK_DISABLE and sys_clock_disable to put
the symbols in the proper namespace and to align with the rest of
the timer APIs.

Change-Id: I341cdb1bd6cc01e5662d8526c293d4e0acd6ec24
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:43 -05:00
Benjamin Walsh d44799de3e systick: remove unused stack variable
Change-Id: I065814867bf8f150e420412d45fadc10e6af7485
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:43 -05:00
Juan Manuel Cruz d34b8f62ae gpio: ioapic stubs apply only with IOAPIC
ioapic_mkstub applies only when an IOAPIC is available in the platform.

Change-Id: I40294e4c11ef04739a1ce2146d125f3c5478013d
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:42 -05:00
Michael LeMay 2ad663da92 gpio: dw: Fix ISR initialization and add NULL checks
This patch updates the ISR initialization code to reflect recent
changes in the underlying Zephyr ISR infrastructure.  It also adds
assertions to detect failures to lookup device bindings during
initialization.

Change-Id: I4bf1955da44a97f8c2652b96a390804c5cea73e3
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:42 -05:00
Tomasz Bursztyka 9b9367176e spi: intel: Fix byte flow and error handling
- ROR interrupt needs to be acked by resetting the bit to 0
- Rx threshold seems buggy on that controller and setting it above 1
  generates unreliable transmission as sometimes it does not trigger any
  interrupt though the rx fifo is just full.

Change-Id: I4949c1fe7b42c70973efd4e0dafd14c6171f13f6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:42 -05:00
Andrew Boie 5e1ae08765 loapic: get rid of function call overhead for _loapic_eoi()
We generally call this in interrupt code, and since it's just a register
write, get rid of all the function call overhead.

Change-Id: I251fa3cee0841fcdd8eecc7941d4d3782d112e66
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:42 -05:00
Anas Nashif 70ff4c91e5 gpio: fixed struct name causing build failure
bad rebase that somehow passed sanity

Change-Id: I7aa7da44cbcb28b9abe3bb81b1ff8d510d135a24
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:42 -05:00
Andrew Boie b43758d22a x86: remove dynamically generated IRQ and exception code
We are interested in supporting some XIP x86 platforms which are
unable to fetch CPU instructions from system RAM. This requires
refactoring our dynamic IRQ/exc code which currently synthesizes
assembly language instructions to create IRQ stubs on-the-fly.

Instead, a new approach is taken. Given that the configuration at
build time specifies the number of required stubs, use this
to generate a build time a set of tiny stub functions which simply
push a 'stub id' and then call common dynamic interrupt code.
The handler function and handler argument is saved in a table keyed by
this stub id.

CONFIG_EOI_HANDLER_SUPPORTED removed, the code hasn't been conditionally
compiled for some time and in all cases we call _loapic_eoi() when
finished with an interrupt.

Some other out-of-date verbiage in comments related to supporting
non-APIC removed.

Previously, when dynamic exceptions were created a pointer would
be passed in by the caller reserving ram for the stub code. Since
this is no longer feasible, two new Kconfig options have been added.
CONFIG_NUM_DYNAMIC_EXC_STUBS and CONFIG_NUM_DYNAMIC_EXC_NO_ERR_STUBS
control how many stubs are created for exceptions that push
an error code, and no error code, respectively.

SW Interrupts are no longer triggered by "int <vector>" hard-coded
assembly instructions. Instead this is done by sending a self-directed
inter-processor interrupt from the LOAPIC, using a new API
loapic_int_vect_trigger(). In this way we get rid of dynamically
generated code in irq_test_common.h.

All interrupts call _loapic_eoi() when finished, since this is now
the right thing to do for all IRQs, including SW interrupts.

_irq_handler_set() for x86 no longer requires the old function pointer
to be supplied.

Change-Id: I78993d3d00dd153c9051c518b417cce8d3acee9e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif c159380c86 gpio: make function names conform to driver name
use gpio_dw instead of gpio_<function>_dw to be consistent in the
driver itself and with other drivers.

Change-Id: Ifb0e50c230f142197eb4b01c1bb4ce1c16e4753f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif 98e0c2cfbc gpio: use BIT macro defined in misc/util.h
We now have BIT defined in a header file globally, so lets use it.

Change-Id: Ie7b87478cb5a9e977ec045efa072d28fab86e78b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Yonattan Louise e378747706 Rename Profiler to Event Logger.
In order to have a name according to the functionality of the feature.
This commit rename any text, function and variable related with the
Profiler name to Event logger.

Change-Id: I4f612cbc7c37965c35a64f06cc3ce5e3249d90e5
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:24:41 -05:00
Peter Mitsis b1c1020732 Add UART irq input hook to uart_console_isr()
Adds an input hook to be used by the interrupt handler uart_console_isr().
This hook permits the console input to detect a character escape sequence
that can be used to override the console's default input behavior.

This input hook can be set using the following API:
   void uart_irq_input_hook_set(struct device *dev,
                                int (*hook)(struct device *, uint8_t));

The hook returns 1 if the handler should stop processing the character,
and 0 if it should not stop.

Change-Id: I95e7da75e07fb6caaca2d45e80bfc4334a43c0ac
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:41 -05:00
Anas Nashif 39dceb21f6 uart: simple: throw an error if configuration options not provided
The simple uart drivers expects configuration options to be defined in
board.h and fails on platforms that do not provide such options.
Throw an error if needed configuration options are not provided.

Change-Id: I8c938868171eb8c1382075275ad96379cfc05a5a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Juan Manuel Cruz faa11b76ee gpio: remove both edge support on dw arc ip
Allows to remove the both edges support from the DW GPIO driver.

Change-Id: I9e39cca320aeac5d10aafe7a83641917ad004fe6
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:41 -05:00
Dan Kalowsky 7ed1abfdda checkpatch: warning - new_typedefs
Removing many of the typedefs that are only used once to lessen the
checkpatch warning about creating new typedefs.  A handful have been
behind as they would require a more invasive change to the code.  It
has yet to be determined if this is a worthwhile endavour.


Change-Id: Ibeb29e0a1d37e8121218fccf0d986cbebd226e85
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:41 -05:00
Johan Hedberg 2b68871f7c Bluetooth: uart: Fix discarding data in case of too small buffer
Even if a buffer can't hold the needed amount of data we should still
cleanly discard the bytes so that the driver doesn't loose sync of the
next packet boundary. This way we also get to remove the now
unnecesary 'failed' label.

Change-Id: Ic921fbf6c0ddef4a7721cee7fa3e01a31b127778
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg fc6b853211 Bluetooth: Clean up Kconfig
Clean up Kconfig conventions.

Change-Id: I06df0b6363cd2dab72e93456455aaef219340e4d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg 4b433d4fa6 Bluetooth: Differentiate send/recv of needed driver headroom
The space that the HCI driver needs to reserve for its own use is not
necessarily symmetrical. E.g. even with the current H4 driver we only
need to reserve space for sending data but not for receiving it.
Keeping track of these values independently enables more efficient use
of the buffers.

Change-Id: I64917b545c5cd77356ed038d09afe76422334661
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg 5f4daa1551 Bluetooth: Merge send_acl/cmd back to a single callback
Now that we have the buffer type enum as part of the HCI driver API we
can take advantage of it to pass the buffer type information and not
have to have two separate callbacks.

Change-Id: Ib2ee5b1540e532c9b27903e97660a276c1293fbc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg 1ddc3edcaa Bluetooth: Introduce HCI-driver specific buffer functions
This way we avoid dealing with the specific buffer type value and to
make it clear that these are for drivers onle.

Change-Id: I8aef7ec6a767b2fa68cbe374eb371e2a6192f675
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg 7ff1cbd976 Bluetooth: Split HCI driver ACL/CMD send callback
This is a necessary step in preparation for removing the buffer type
information from the buffers.

Change-Id: I29d8fae32aa660416a1c12e87840499c711e659f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg f1baa0b8fc Bluetooth: uart: Remove incorrect buffer type check
It's invalid to try to send HCI events to the controller so we should
treat such buffer types as invalid in bt_uart_send().

Change-Id: I4108a158d5b91f364a9f3c56e3037f03755daa19
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg ea11d4b5cd Bluetooth: Add helper macros for accessing Bluetooth user data
To avoid unnecessary stack variables and to simplify code, add helper
macros to access the Bluetooth specific ACL and HCI user data that's
part of the buffers.

Change-Id: Idc337537721115c4091982c04f8a05bbbf0d5a19
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg 1f01f1da16 Bluetooth: uart: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I8df37d214e1f93ee472cde82c4198d667709ff5a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg 581fa90ea8 Bluetooth: Initial conversion to net_buf API
This patch performs the minimal necessary conversion to the net_buf
API. It uses a temporary "#define bt_buf net_buf" to make it possible
to convert the code in smaller increments. Most old bt_buf function
also serve as one-line wrappers to the matching net_buf APIs. Once
everything is converted these helpers will be removed.

Change-Id: Ie31433d33576022c9c193a35d2389267005545d6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Michael LeMay ebba3bf38b eth: dw: Add driver for Synopsys DesignWare Ethernet MAC
This patch adds a driver for a Synopsys DesignWare Ethernet MAC.  The
driver uses interrupts to handle received frames, but it uses a
spinloop when transmitting to wait for the transmit descriptor to
become available.  Transmission is coordinated by a fiber, so this
should not result in the system execution being blocked.  Only a
single descriptor is allocated for each of the transmit and receive
directions to save memory and simplify the code.  Another
simplification is that none of the offload capabilities of the
Ethernet device are used.  The driver currently only supports a single
instance of the Ethernet MAC, which is consistent with the limitation
in the network stack that only a single network device is supported.

Change-Id: I013b3d439a76e8ff91a775516f7035841b040870
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:38 -05:00
Michael LeMay 2684f4472f pci: Add pci_enable_bus_master
This patch adds the pci_enable_bus_master function that enables bus
master access for a PCI device.

Change-Id: I317daac1a613ccfc5a3894332c1a7dbbff05991f
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg 79bd18e683 Bluetooth: uart: Remove dead code
There's no point in having a return value for uart_out() if it always
returns the same length that was passed to it. Just make it return
void and remove the error handling code from the caller (which would
never have been run).

Change-Id: I88dab7499a5f526ca65058640021f84e1b3486ca
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Andrei Emeltchenko 82f33267c5 Bluetooth: Change fifo_fill to poll_out
The reason why fifo_fill works in qemu but not on real hardware is
that qemu serializes all byte transmission 1 by 1. There is no
real hardware fifo emulated, and "fifo" depth is 1. On real
hardware, the controller owns an internal fifo, with a depth like
8 bytes on Quark x1000. And because of execution flow, how fast is
the controller etc etc... a fifo_fill call might fill in the
internal fifo of 8 bytes and then controller says "I am full"
(which means: "wait for the fifo to have space again"). That's
why poll_out() works: it does the same as fifo_fill and wait
that the internal fifo gets some space again before continuing.
And only when all bytes have been pushed in, it returns.

Change-Id: I452a6ebb2913c5e52ed01d999185e250aa3ed474
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:24:38 -05:00
Anas Nashif f140d6342c console: set range for UART_CONSOLE_INDEX
Catch cases where index is set to negative or wrong values.

Change-Id: Ieab73e0fb12cecfc6c3c3d74c7d41f640bc88f01
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:37 -05:00
Dan Kalowsky 8cbb09ec37 pinmux: cleanup galileo defines
The galileo board no longer needs an extern of the initalize
routine once we've moved the process to the actual file.

Change-Id: I21a0748729b2435a368e28b3a2744b2089ed1e13
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:36 -05:00
Dan Kalowsky 1c0da55154 grove: KConfig cleanup
Adding in dependency of GROVE_DEBUG to the GROVE configuration
option being set

Change-Id: I4108e619254ca3cde2b96de595e1b8300fe6a752
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:36 -05:00
Andrew Boie 876c86e1a8 ioapic_intr: remove dead code
XIOAPIC_DIRECT_ADDRESSING and IOAPIC_MSI_REDIRECT are never
set and not tied to any config options.

Change-Id: Ib64cd198c99fe670eb5bcd946ce93f616c03d12a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:36 -05:00
Dan Kalowsky d89c3b598b checkpatch: warning - space_before_tab
Change-Id: I8d36cdcdd1822cafa7f53f8b8a8788992b0703e3
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:36 -05:00
Dan Kalowsky 2a57d02400 checkpatch: warning - spacing
Change-Id: Ia63d6c9d8d3c1bd9c540a039263cb8507af82b1e
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:35 -05:00
Dan Kalowsky 2a63743192 cleanup: removing NOMANUAL
The \NOMANUAL tag is a remnant from days of yore and is no longer
needed or useful.  Cleaning up the code references to this.

Change-Id: I1b8cc9c9560d1dbb711f05fa63fd23386789875c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:35 -05:00
Andrew Boie 090385b666 x86: remove boi handler support, eoi argument
This was only needed for the older 8259A style PICs which are no
longer supported.

Since we now just support APIC, we always just call loapic_eoi which
no longer requires an argument and informs the IOAPIC that the interrupt
is complete if necessary.

Change-Id: I15c9b7b4f03b872656220af32220b62e043bfa6b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:35 -05:00
Tomasz Bursztyka e560c90c0e galileo: SPI and pinmux init level need to be reversed
SPI port 1 needs the pinmuxer to be initialized first. Or then, all
modifications required from the CS GPIO logic won't apply.

Change-Id: Ibe4b2d4096065a9add23373075090d5e8a014650
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:35 -05:00
Tomasz Bursztyka 95116abb0b spi: galileo: SPI port 1 uses DW GPIO pin 2 for CS
As for the SPI port 0, SPI port 1 needs a GPIO pin to emulate the CS.

Change-Id: I00911cd25c3fa0ae17a02ee6f43cbea7f4fbcca2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:35 -05:00
Tomasz Bursztyka 75a11278f1 spi: intel: Fix the retrieval of the clock divider
Obviously it's '&' and not '&&'.

Change-Id: I9bb9fee80a67697e8ea62bb001af1b72f5a356e6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:35 -05:00
Dan Kalowsky b0f7fe20e0 i2c: fix init for I2C1 device
The I2C1 device is currently using the older device initialization
method, and thus will not work.

Change-Id: If193f20275262abc3b08edd3a26679ae9ad39d94
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:35 -05:00
Dan Kalowsky 5339eccc23 intel_spi: convert SPI to new driver init method
Convering the intel_spi to use the updated device model

Change-Id: I016822aeecaf707ffa31b57b4e51e99262fce0e5
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:35 -05:00
Peter Mitsis f1a4760157 Fix Kconfig SHARED_IRQ_1_PRI dependency
The kernel configuration option SHARED_IRQ_1_PRI is dependent upon
SHARED_IRQ_1, not SHARED_IRQ_0.

Change-Id: I018cd8e860c362572cdde8586e50aed990d350bc
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:34 -05:00
Peter Mitsis 5084b6da56 Fix various default IRQ priorities
Changes the default IRQ priority level from 0 to 2 for the following
kernel configuration options as priorities 0 and 1 are reserved for the
first 32 IDT entries.

	SHARED_IRQ_0_PRI
	SHARED_IRQ_1_PRI
	I2C_DW_0_INT_PRIORITY
	GPIO_DW_0_PRI
	GPIO_DW_1_PRI
	SPI_INTEL_PORT_0_PRI
	SPI_INTEL_PORT_1_PRI

Change-Id: I0fc821c68156eb1e1fe776b2bd4ff5890bba40e8
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:34 -05:00
Michael LeMay 2b5319583f gpio: dw: Fix PCI enumeration support
This patch corrects gpio_dw_setup to use the MMIO base address
determined by PCI enumeration when that enumeration feature is enabled
instead of always using the default base address specified at compile
time.

Change-Id: If139c40ce30275694e01196a4a4aa529cd714f06
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:34 -05:00
Dan Kalowsky 7f9080671b checkpatch: warning - suspect_code_indent
Change-Id: I7e920e6de8f4b7a726c03c05edea3cbac69eb374
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky 890cc2f1ef checkpatch: warning - line_spacing
Change-Id: I2276676142deea21cf8079449ce153f2fb887a8e
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky e45956c9a0 checkpatch: warning - leading_space
Change-Id: I34a54230bc4a63c8a4391d03ff530835910c3705
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky e8563c2f97 checkpatch: error - trailing_whitespace
Change-Id: I819d13f0d7a23e3a61dcda6a3ced18810b192158
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky d11f8ecf9f checkpatch: error - static_initiazation
Change-Id: I6e3dc44be7bb6d01a7181d8c8e90cdb72120c3db
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky da67b29569 checkpatch: warning - block_comment_style
Change-Id: I6da43e41f9c6efee577b70513ec368ae3cce0144
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky 6c62b1a4f9 checkpatch: error - code_indent
Change-Id: I2298add2399559d95c75a90c045286046372b7e0
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky 3a109b1f00 Adding in doxygen comment headers
Moving many of the functions from the old format of inline comments to
the newer doxygen format.

Change-Id: Ib0fe0d8627d7cd90219385a3ab627da8f9637d98
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:33 -05:00
shuang.he@intel.com f6d62ec1bd spi: Fix one simple typo
Change-Id: I1e8236deef5270f3d86334652fb456b820357639
Signed-off-by: shuang.he@intel.com <shuang.he@intel.com>
2016-02-05 20:24:32 -05:00
Anas Nashif bcc16634ac spi: move static stubs to driver directory
Change-Id: Idd08e79eec429df00673a10790ec85afbe3183f6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:32 -05:00
Anas Nashif 87fe9387fb shared_irq: move static stubs to driver directory
Change-Id: I55808e5e460486c7f61919eca0aba9e2f4b434e1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:32 -05:00
Anas Nashif 47869287a4 gpio: move static stubs to driver directory
Change-Id: I6077aaeba4d572ddfa9d696014c6aec08abd3d3a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:32 -05:00
Andrei Emeltchenko c7b152932d galileo: Remove unneeded defines
If console handler is defined uart console should also be defined.

Change-Id: I3efcc6c837f8f1621340f7f13bf0603d7dc42fb2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:24:32 -05:00
Tomasz Bursztyka 17e06fb457 uart: Move generic API to root directory of include
Only driver specific public headers should be found in include/drivers.
All generic API are found in include/ directory.

Change-Id: Ic50931987bb9460fd4a3843abc6f5de107faf045
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:32 -05:00
Dirk Brandewie 94c2960227 i2c: designware move to using single isr
With ioapic_mkstub now taking a context value we can have a single isr
routine and move away from the isr trampolines we have now

Change-Id: Ibbb0f627ac515b12c0590a71da6a3267c952dd30
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:31 -05:00
Dirk Brandewie ad5af93f25 x86: Add context value to loapic_mkstub and ioapic_mkstub macros
Add a context value to the ioapic and loapic mkstub macros to allow
the developer to specify a context value that will be passed on the
stack to the interrupt service routines.

All the invocations for the loapic_mkstub and ioapic_mkstub macros
have been changed to pass in 0 so there is no functional difference
ATM.  This change removes the need for drivers to have trampoline ISR
routines to pass a context vaule to their generic ISR routine.

This is the first step in getting rid of the hack where the driver
needs to look into the __initconfig_* linker objects.

Change-Id: I2c5eaa20d8cb5a42ef445762c426854be32c8452
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:31 -05:00
Dirk Brandewie 147d6585ae x86: arm: Modify IRQ_CONFIG macro to have same signature as ARC
In order to have drivers that are usable cross architecture the
signature for IRQ_CONFIG needs to be the same to avoid #ifdef hell in
the driver code based on architecture.

Update the macro and it usage for existing drivers

Change-Id: I22e142b21d4e984add231d1dbd97020e4823985f
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky 2e938481ce checkpatch: error - initialised_static
Change-Id: I8f51f861e2250c87c296b697ef5b6610ce644b34
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky e4bb957a00 checkpatch: error - pointer_location
Change-Id: I9ce224cb75ba21caecffd6747833257f748b5ecf
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky a60c866c70 checkpatch: error - open_brace
Change-Id: I434037ce969bcd1fc08bd4b407f9508773e64b1e
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky 39063598db checkpatch: error - spacing
Change-Id: Ie6e1c43581dd4b0734625b3a4e59a4ca79619e99
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky 3bc4039601 checkpatch: error - switch_case_indent_level
Change-Id: I9cbd6ab80b0c0f170626bb1c6b2d07498038fb8f
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky 978851fb6a checkpatch: code_indent failures
Corrects the checkpatch code_indent failures

Change-Id: I2ff93b8907d3eddbaa543ccbd12aecef8af7f698
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky 247dc8f2d1 checkpatch: removing C++ comment style
checkpatch currently reports several files failing the C99 comment
verification.  Cleaning these up now.

Change-Id: I35766c1f6c88a280c5e844b3f02668d6e1ad11d2
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky c936f6a029 random: rename random to use underscore
Naming convention of the OS requires the use of underscores (_) for
filenames instead of dashes (-).

Change-Id: I62b615f1f336e839cbbef2c3721c1926afe76457
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky 70b8230397 pwm: renaming files to use underscore
Naming convention states we should be using an underscore (_) for
filenames not a dash (-).

Change-Id: I51a6ae02957bfc556b8718aae713636bd14c8b2c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky 286a7e2bfe adc: renaming ADC files to use underscore
The naming convention is to use underscores (_) and not dashes (-)
within the filename.

Change-Id: I678cf01306d72a905ed7b161af116c6e4a2cd39c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky 6bf971915f gpio: rename files
The naming convention used in the source is for there to be an
_ and not a - in the file.  Fixing GPIO to be consistent with
the os naming conventions.

Change-Id: Ifc4356c14b52e2cc2411a7445b44c7cb57d2765c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Dan Kalowsky e899bb60ac i2c: changing file names to be consistent
Naming convention uses the _ not - in the file names.  In a recent
commit for I2C this for some reason changed.  Making the names now
more consistent with other files.

Change-Id: I1e363c0c09ae0c8b2ac3def3beeaaeafcc01eb74
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Javier B Perez Hernandez 7ea76b96fd Change new files from BSD-3 licenses to Apache 2.0
Change the new files from Intel in BSD-3 to Apache 2.0

Change-Id: Ica4b455e9cb8134889f2a88e2d96094ce7093734
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
2016-02-05 20:24:30 -05:00
Allan Stephens 7b006066a4 init: Simplify symbol name generated by DECLARE_DEVICE_INIT_CONFIG()
Gets rid of the trailing initialization level character from the
name of the device variable generated by the macro, since it serves
no useful purpose. (The linker scripts place the various initialization
sections in ascending order based on the name of the section, so there
is no need to embed the initialization level in the variable name itself.)

Change-Id: I56bb79a513b8f77fb1f3fbaccec14454c2520772
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:29 -05:00
Dan Kalowsky 61d87f57f8 grove-lcd: import of Grove LCD I2C controller
Initial import of the Grove LCD I2C controller.  Data sheet can
be found at:
http://www.seeedstudio.com/wiki/images/0/03/JHD1214Y_YG_1.0.pdf

[DL: Updated command sequence according to datasheet.]

Change-Id: Id1b491f8dce346769dc42c41fac0ea3aabe3950a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:29 -05:00
Tomasz Bursztyka d2669b7a00 spi: intel: Port 0 needs gpio driver to be ready if using it for CS
GPIO driver is initialized at pre-kernel-late level, if SPI does it too,
it will happen before GPIO (depends on the ordered list of
initialization). In order to ensure it gets GPIO initialized always
before SPI, let's set SPI to initalize at the next level: nano-early.

Change-Id: I6e34168c88fca0187a809bf5c7971492bd5acb5c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:29 -05:00
Javier B Perez Hernandez f7fffae8aa Change BSD-3 licenses to Apache 2
Change all the Intel and Wind River code license from BSD-3 to Apache 2.

Change-Id: Id8be2c1c161a06ea8a0b9f38e17660e11dbb384b
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:29 -05:00
Tomasz Bursztyka 5bcdfbe255 adc: Adding driver for TI's adc108s102 chip
It's an SPI driven chip and proposes up to 8 channels for input
conversion. It's found on Galileo board.

Change-Id: I916367e9be0849812c6a509082a501730a01ce60
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:28 -05:00
Tomasz Bursztyka 524a50e61e spi: Add a utility pointer for the application on SPI callback
It might be needed sometime to get some private data forwarded to the
callback, thus such user_data pointer is the easiest way to proceed.
Adding a macro to set the word size as well.

Change-Id: I68cbe2d480120253ccb13f13c656a38c27e21604
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka ded73a41b1 spi: intel: Only look for TFS and RFS in status when handling isr
If those are not set it means the controller has nothing to request
anymore from the driver.

Change-Id: Ie7e834e82b931e4b02ded3f9f619735b31b0a121
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka 6090d779d7 spi: intel: Move back private structures to the right locations
Since the driver is the only one needing those, no need to expose them
anywhere.

Change-Id: Iac4eaa65a9dbdaa8e72c70ea0de35cd2b3d836d1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka f18275a5be spi: intel: Switch CS before unmasking and after masking interrupts
At this points the slave is ready to deal with the master.

Change-Id: I815d3c577bd0b73100cbf585cc8ca78f180ec713
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka 15058e21ef spi: intel: Fixing how speed is set
This was failing, the documentationg provides numbers only telling at
one places these are hexadecimal values. So switching to hexadecimal.
Then DDS rate retrieving macro was bogus, so fixing it.
And adding debug output about the DDS rate and the clock ratio.

Change-Id: I9cc414796fbd7f7123f1f406c6bce7ffacf641e8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka e6fc1c2049 adc: Add drivers infrastructure
Only Kconfig file for now.

Change-Id: I633ac209583b2fe6cbed3c75036ac245f0058df6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung 1c96cdeb52 i2c: simplify API and driver_api with generic transfer function
With the introduction of generic transfer function, it is no longer
needed to specify read or write functions explicitly in drivers.
All read/write functions can now thus call the generic transfer
function to achieve the same result.

With this change, the transfer function becomes mandatory, and
should always be available.

Change-Id: Ia6fb98e58b84330a56a5d44ed3df9db42c3a5e88
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung 827f6d018b gpio: pcal9535a: use i2c_poll_transfer() for register read
The newly introduced i2c_poll_transfer() is now used for register
read for PCAL9535A GPIO driver. The old write then read does not
work because every read or write ends with STOP. However,
the chip requires RESTART after writing the register address.
So the new generic transfer function is perfect for this.

Change-Id: I56d7ebe08f68cb04731c72138d60645ef124f65e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung 01796ecf5c i2c: dw: implement generic transfer functions
() For interrupt driven transfer, the driver already has
   a generic transfer function, so this simply exposes it
   for public consumption.
() The polling write is extended to support generic
   transfer.

Change-Id: I657db8a6376282c723728b7a875813d389cf7d27
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung 76bfe7b3a1 i2c: dw: re-organize transfer related code
() Re-organize the steps involved in data transfer, according to
   the datasheet's flowchart.
() Extract the common code for transfer initialization and put
   it into its own function.
() i2c_write() and i2c_polling_write() are now using the common
   data sending function.

Change-Id: Ieb90253ee10ddceb3b5d05b258e7fc6253d18729
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung c615ae56cb serial: nsim: add dummy poll_in function
Both poll_in and poll_out are supposed to be implemented
in each driver, as these are basic function.

Change-Id: If1b6b11834f57934fe7e776bfcf818e088abdd0a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Dmitriy Korovkin 13b3e2a127 Add PCI legacy bridge device driver
PCI legacy bridge is a device connected to PCI bus and
allowing to program the routes from interrupt pins to IRQ
numbers.

Change-Id: I129719d71f958bbf5ad8c5c9949dcea93d94b89d
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:23 -05:00
Dan Kalowsky 464a534834 shared_irq: adding copyright to Kconfig
Change-Id: Ic6f318f9ed4eabcde74aca3c60fa27f114089300
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:23 -05:00
Dan Kalowsky 32036f0718 pci: adding copyright to Kconfig
Change-Id: Ie02c3c3e6db685372330627c48f240fbd7061d0d
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:23 -05:00
Dan Kalowsky a6f526ed1f gpio: Adding copyright to Kconfig
Change-Id: I2abcdf3138de3ae39c6c5d428627d9b2fd6f8a01
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:23 -05:00
Tomasz Bursztyka 0f402c10a4 pci: Kconfig: Disable PCI enumeration by default
PCI enumeration is not mandatory to enable as static information can be
provided. Plus, it does not integrate yet properly with shared IRQ as
well as setting dedicated IOAPIC paremeter for certain drivers.

Change-Id: I221b2a8a2179993a264e5f3eb93cda0e121d9abe
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:22 -05:00
Tomasz Bursztyka 553cee8aea spi: galileo: Pre-configure SPI ports present on Galileo board
Providing the right settings through Galileo's Kconfig.

Change-Id: Ia5339eb90cb98d7dde3be0493bcfd9a6b6db60ed
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:22 -05:00
Tomasz Bursztyka 3f5083e9f6 spi: ia32_pci: galileo: Add options to allow SPI IRQ trigger
Add Kconfig option to specify how interrupt is triggered for SPI.
Also enabling such support for Galileo platform.

Change-Id: Id3112d100089197940f826b827493174d0f22669
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:22 -05:00
Tomasz Bursztyka 4cace6d2d7 spi: Add the CS pin control over GPIO for intel spi port 0
This is specific to Galileo board where its SPI port 0 needs to setup
the CS pin through a GPIO pin.

Change-Id: I9df6f7144a96bcd10f61fc7d057f89caa0e599d1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:22 -05:00
Tomasz Bursztyka 854d77aa37 spi: Fix init level data id
Change-Id: I51612bbea34fa7b32b09bd15a97ab0c6e0a8c9fd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:22 -05:00
Daniel Leung 6324168e88 i2c: dw: fix setting default configuration
Fix previous rebasing errors (before merging) where deleted code
was reintroduced back. This causes the default configuration
in Kconfig to be ignored.

Change-Id: I29b246b1459136521d764127bf02e6d8e5aff30c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:22 -05:00
Daniel Leung 9299ef07cc x86: galileo: expand pinmux to setup GPIOs on SoC
This expands the Galileo pinmux driver to configure the GPIOs
on the DesignWare IP block, and the core/resume wells on
the legacy bridge.

Change-Id: Ia1df4b6fd3b104f08563fe9eab93f01efbb53b66
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:22 -05:00
Daniel Leung 8c6714e297 gpio: dw: ISR bails early if no interrupts
If using with shared IRQ, this function will be called by
the shared IRQ driver. So we need to check and bail out
early if the interrupt is not coming from the GPIO
controller.

Change-Id: I4ae925f5fb9a5c32d03a180edc8460e978ec0aac
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:22 -05:00
Daniel Leung 5992aa363b i2c: dw: ISR bails early if no interrupts
If using with shared IRQ, this function will be called by
the shared IRQ driver. So we need to check and bail out
early if the interrupt is not coming from the I2C controller.

Change-Id: I3c3ae3c22aa5cf312de5c22b35765749d6c5929d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:22 -05:00
Tomasz Bursztyka 5d0bc718da i2c: Kconfig: Do not provide platform specific default settings
Such settings belong to Galileo and thus are set in Galileo Kconfig.

Change-Id: Ib9ec721fcc68e92521f8b7690c2640eeb82b2f4c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:22 -05:00
Tomasz Bursztyka ddb35ccfa6 i2c: Support the generic API callback in designware's controller driver
Call the callback when relevant:
- When STOP_DET if received
- On error

Change-Id: Id60190c6ac5c0b15a0a6cd3fb30b9cc41f2333e8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:21 -05:00
Tomasz Bursztyka 4df5c1cab0 gpio: dw: Verify interrupt status on available bits only
Handle only the pins which have been configured to be present on this
controller. Removing an unused #define as well.

Change-Id: I66d3638333f1fcd49b1b4f70a5c9d11dbc538fd0
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung 32121585da i2c: dw: add shared IRQ support
On some platforms (e.g. Galileo), the I2C controller is on PCI bus,
which shares IRQ with other devices (GPIO on Galileo). This patch
adds support for utilizing shared IRQ.

Change-Id: Id4e4714aed37c2893d0ffe9ed1e4edaabb338121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung 25c5ceaad1 gpio: dw: add shared IRQ support
On some platforms (e.g. Galileo), the GPIO controller is on PCI bus,
which shares IRQ with other devices (I2C on Galileo). This patch
adds support for utilizing shared IRQ.

Change-Id: I4b44bae15356e4710d54f0343fed1bd27f35e484
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung 006555a17b shared_irq: add config options for interrupt triggers
This adds options to the shared IRQ driver so the interrupt
triggering condition can be specified.

For example, the GPIO and I2C controllers are under same
interrupt line through PCI bus. The triggering condition
is level, active-low. So this option can be used by
the Galileo platform to program the IO-APIC correctly.

Change-Id: I1c3af98442e775b4987ab36a644c856052d85ec4
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Dirk Brandewie 002c53b225 drivers: add shared interrupt driver
This driver allows multiple drivers to share a common interrupt
line. This functionality is required on system that conform to the PC
interrupt structure.  In the context of Zephyr this is needed for
SOC's that have their I/O IP blocks behind a PCI interface. Due to the
limited number of interrupt lines provided by the PCI interface
multiple IP blocks may be configured to share an interrupt line.

Drivers that share interrupts  must be modified to *not* register their
own interrupt service routine as part of their configuration/initialization
but instead bind to the correct instance of this driver by name, then
register their interrupt service routine with this driver.

Change-Id: I57b517b97ebeabce484ba53c8f940da993cb391d
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung a5f0974131 pwm: pca9685: use polling I2C write instead
The polling I2C write function guarantees the write operation
is completed. It is to make sure each write has been commited.

Change-Id: I37cd3b8a65c605837b1fae3ccd1c2b0235c07a37
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung 32d42f313e gpio: pcal9535a: use polling I2C write instead
The polling I2C write function guarantees the write operation
is completed. Given that the initialization routine goes through
I2C write consecutively, we want to make sure each write
has been committed.

Also adds code to configure the I2C controller before transfer.

Change-Id: I2c8888e940edd1cb9fb01f03234a731ac991dfcf
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung bd86869cc5 i2c: dw: add polling write implementation
This implementation will wait to write, and wait for transfer
to complete before returning from the function. Currently has
a default timeout of 100ms to prevent being stuck in the loop
waiting for hardware to be ready.

Change-Id: I0340fc6fed100f1d31c0306c5b0ab09689364f63
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung 0502a9a084 gpio: mmio: add access by I/O port
Add I/O port access to MMIO-based GPIO driver, in addition to
the existing direct memory access. This extends the driver,
so that it can address the registers through I/O read/write.

Change-Id: I53c74ad76472ac043764e33bfbb77a2bedc427fe
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Dan Kalowsky ccb9b8f338 i2c: dw: interrupt selection no longer controller specific
The interrupt selectionss are no longer specific to a particular
controller (e.g. I2C_DW_0), but apply to all controllers on
the platform.

[DL: Extracted these changes into their own patch, instead of
     being squashed with others. Also modified the Kconfig
     options to move them into proper position.]

Change-Id: Idc7ac9769e947447b868dccf772a95dbb5fc8021
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung 0daf9dfd19 gpio: pcal9535a requires nano timer
Add a Kconfig option to enable NANO_TIMERS for PCAL9535A.
Without enabling nano timers, compilation may fail.

Change-Id: If96358a17b9522f9323f3480b4716c3dfd82a3de
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung 8c27aedb79 pwm: pca9685: remove call to i2c_configure for every write
The I2C controller should have been already setup before this driver.

Since the only use right now is on Gelileo and I2C_DW driver. it is
safe to remove the i2c_configure() call now as the driver has default
configuration at boot.

Change-Id: Ia384e28871bf76dcfec899860f93da4bf0948ba6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Daniel Leung 2104dcde39 i2c: dw: provide default configuration for controller at init
This adds the Kconfig option to specify default configuration
for the I2C controller during driver initialization.

During boot, the controller needs to be configured before
communication to slave devices can start. After boot,
an app can re-configure the controller if needed.

Change-Id: I7bf252f75a31943ae444e4d914f3a9a1a3f3d91f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:21 -05:00
Andrew Boie 1cdb72b909 ipi_console_sender: enable printk() implementation
Change-Id: Ib4ce8b0bb128700dc1e3d72bf85ea1111f1a3880
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:21 -05:00
Dirk Brandewie b89cb06f5c drivers/pci: kconfig: Add prompt for PCI options
Change-Id: I9b7d581c9407aaa191fdd241945d0b27da2a5ae2
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie f96f61d2f0 init: rename pure_early_init to pre_kernel_early_init
Change-Id: Id52cd7a5c1a715a5c609f88f940ec2e27341d81e
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie 4365f02391 init: rename pure_late_init to pre_kernel_late_init
Change-Id: I9561315a892933370d60fcf36c10d38078d66233
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie 58a534b929 init: add pure_core_init level
There are devices that need are part of the architecture core the need
to be initialized prior to devices that are integrated around a core
to make up a complete SOC. Namely the interrupt controller in the SOC
must be configured in order to allow the integrated IP blocks drivers
to initialize correctly.

Change-Id: I0a91e08f98516a7b7dd402ffc6494a071f1326b2
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie c48418f2bd init: remove pure_init macro
This macro is legacy from an early implementation of the init system
before the pure level was split into early and late phases remove it
now to avoid confusion going forward.

Change-Id: I6720874c840c9e14888fd6f411a8182e7420ca29
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:19 -05:00
Dan Kalowsky 2d6ba51742 pinmux: Add API for pinmux driver
This provides the API to manipulte the pin muxing, where
a single pin may provide different functions depending on
settings.

[DL: changed commit message.]

Change-Id: Ifd161137c062dff184024b5aa34737604911d09c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:19 -05:00
Daniel Leung cb1c7816f8 pwm: add driver for PCA9685 PWM chip
This adds the driver for PCA9685 I2C-based PWM chip, and provides
basic PWM functionality.

Change-Id: I8c711d9b703fdaf5ccb23657e07495a95cbe16ee
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:19 -05:00
Anas Nashif 31779e736c gpio: fix build issue when init.h is not included
Fixes a build failure in designware gpio driver.

Change-Id: I90a540f56bff17ff56d0315356fde6d6c4d02407
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:19 -05:00
Daniel Leung b96703b516 gpio: pcal9535a: cache write values to registers
Register values are now being cached in memory, and are being used in
subsequent writes. This is to avoid reading from registers, as
we know what needs to be written to those registers all the time.

Change-Id: I9b344303c0cb9f28e974514ab674135004f68ea0
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:19 -05:00
Daniel Leung e52e4cdd1d gpio: pcal9535a: fix a logic error
The _has_i2c_master() should return 1 if there is an I2C master.
The logic was incorrectly inverted. So fix it now.

Change-Id: Ic4bf44efc1f68644530a275f0c4e454740a2950a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:19 -05:00
Daniel Leung 56bfe61544 PWM: add public APIs for PWM drivers
This adds the public APIs for PWM drivers. Also, this adds a Kconfig
and an empty makefile for drivers to extend.

Change-Id: I1cc0c908b6f5aeeb678b6368640d5b9a1cc9751d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:19 -05:00
Dan Kalowsky a853601c97 i2c: marking functions private
Following the naming convention established, private functions
should be prefixed with an _

Change-Id: Ib6006ba3a928da88b8b8c3324f7d4b833f736270
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:19 -05:00
Dan Kalowsky daf7393808 i2c: naming functions to follow naming convention
Many of the i2c functions continue to exist in a format of
<IP>_<interface> and will now follow the <interface>_<IP>_
naming convention.

Change-Id: Ic7ec879105f5c06f0213f8d771b3811253c49658
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:19 -05:00
Dan Kalowsky 522cd73e04 i2c: fix interrupt clearing
Clearing an interrupt in DesignWare is done by reading the port
not by writing to it.  Original problem found by Dmitriy@WR.

Change-Id: I1de052632ec36e2d496c563e81307169e9dabcf4
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:19 -05:00
Tomasz Bursztyka b445e06cad x86: Add an option for legacy IO ports
Those ports uses different instructions to get accessed: in/out
instructions. It differs in many ways with memory access, and it's much
slower. It's unset by default, but some arch exposing legacy UART ports
might need it.

Change-Id: I06f2a7c7812e720863957bd20d5c2b8b02c10734
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:19 -05:00
Anas Nashif 55bad6996a gpio: include printk.h for debugging with printk
Change-Id: I877b51e2b9a4cbe5a5b99d9cb6b611127fb83d32
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif 2dab2bd255 i2c: move irq stubs to driver
Change-Id: I4d6a40d3c5343b444678a4adcd78a8e3fe9ab515
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Daniel Leung 5e66dada51 i2c: dw: fix build error after file renames
The header file was renamed in previous commits, but the #include
referred to a non-existing file. This causes compilation error.
This uses the correct file.

Change-Id: Ibda7dbca82323d99dcff71cbee8f642f6cd611d6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif 2ae45147a5 gpio: fix gpio Kconfig dependencies and display in menuconfig
Change-Id: I254acb070bcecffe54489e4efe659b488661c043
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif 8f98b0d94b Kconfig: keep i/o drivers close in menuconfig
Change-Id: I5c39063b13d79e65c77015fad224e1a5e81c8951
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif dcbf8d52b5 i2c: rename config variables I2C_DW0 -> I2C_DW_0
This makes variables readable and consistent with other drivers
we have.

Change-Id: I816f133279497eafd5d5614013c8d224d5909590
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif 00cf074796 gpio: Move GPIO option from platform to driver
Change-Id: I136efa8a86314137904e191957bb0922fecdb757
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif 722f42c6de i2c: move i2c kconfig entries from platform to driver
Change-Id: I1f93ccce09235fef65ad06a4a246315709203cba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif 18a3fcff17 i2c: Update Kconfig for i2c drivers
use menuconfig and remove circular dependency

Change-Id: I4962c9f523c5d1487f49a153e1087a72301312d3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif f2241deaa4 rename i2c driver files using <type>-<driver name>
Follow the same order of <type>-<driver name>

Change-Id: Iac9f01f864c2ac76ee7aadf8cbdbb12835f39df4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Anas Nashif 6d107887c6 i2c: rename DW_I2C -> I2C_DW
This driver naming is an exception which compared with all other drivers
we have. To keep things consistent the configuration options and variables
are renamed to <type>_<name>.

Change-Id: Ib95aa09630a507848f78d8f2c28706b545eed06d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:18 -05:00
Andrew Boie 086430e4a0 ipi_console_receiver: fix semaphore usage
Don't give on the semaphore if the ring buffer is full.
Fix a missing newline in a debug message.

Change-Id: Ic0030365665c32cc9f1c641f9dacffd1a1915b09
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:18 -05:00
Andrew Boie 9ae62b5bcc ipi_console_sender: filter out '\r'
Some platforms send over \r\n for newlines, just send over the \n.

Change-Id: Ia6072eb3719a4c7dd828457cf1634d16f4eec38a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:18 -05:00
Andrew Boie 7b52823f64 drivers/console: fix missing '+=' in Makefile
Change-Id: I9eaa40bed937ce2201a7b7f2b1c94c8c35b550d0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:18 -05:00
Daniel Leung 721bb7afb3 gpio: add driver for MMIO-based GPIO ports
This adds a simple driver for MMIO-based GPIO ports.
It does not trigger any interrupts due to pin level at this moment.

Change-Id: I0c439f221988817e4be72653c68257ef6ace5bde
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Daniel Leung 2709050112 gpio: add driver for PCAL9535A GPIO chip
This adds the driver for I2C-based PCAL9535A GPIO chip.
This currently only enables minimal set of features of the chip for
very simple input/output operations, and does not support interrupt
yet.

Change-Id: I32ea07a71a38866280a96e68cff49cb0df12b85d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Daniel Leung 792930172a gpio/dw: Kconfig: put DW selections inside GPIO menu
This change puts the DW GPIO Kconfig selections inside GPIO menu.
This also groups all DW GPIO related selections under GPIO_DW.

Change-Id: I776f3f6b89e1a4dc366648f8290abb27de9eceb8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Daniel Leung a5876981fe i2c: dw: fix compilation error
This was missing an include file, which caused the macro to not
be expanded correctly. Including init.h fixes the issue.

Change-Id: I6b190e0c75828d9b6eb42a84c213dfc174510740
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie 25c9d021a5 x86: move IOAPIC driver to device model/init system
Change the IOAPIC driver to be initialized directly from the init
system. The function signature of _ioapic_init() function is updated
accordingly.

Change-Id: I2f824ac745926966eebb23f60445a41e1df9eb8f
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie be1b1a4e35 x86: move LOAPIC driver to device model/init system
Change the LOAPIC driver to be initialized directly from the init
system. The function signature of _loapic_init() function is updated
accordingly.

Change-Id: I5ed26d53524c8526d413a05ac9a7a58dd4264c5a
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Dirk Brandewie 1bcb7a339a x86: Move PIC driver to device model/init system
Change the PIC driver to be initialized by the init system. To be
initialized by the init system the function signature of the
_i8259_init() function needs to be changed to the standard *_init()
function signature specified by the device model.

Change-Id: I63bf1cd0ce78920fa20da94f5966e5aab4bf41b2
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Andrew Boie 2a1e4266e8 IPI console driver with test case
This introduces a generic driver set for console messages routed over
inter-processor interrupt (IPI) channels. These drivers bind to a
low-level IPI driver instance for the actual transport of messages.

ipi_console_sender installs printk and/or stdout hooks to forward
messages over IPI. There is currently no buffering on the sending side.

ipi_console_receiver installs an IPI callback which stashes incoming
characters into a ring buffer, which is monitored by a nanokernel
fiber. The fiber buffers the characters on a per-line basis and sends
them to either printk or stdout. Multiple instances of this driver
may be created in case you need to receive console data from multiple
CPUs.

Change-Id: Icebc110794fbe040f975101cd2ae6e78fb38645a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:17 -05:00
Andrew Boie 858decd162 misc: don't depend on serial drivers for printk()/printf()
We are introducing other kinds of drivers which support a console
that isn't over a UART.

Change-Id: I0dddbdce958437b5709c5ab26252ed47d030413d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:17 -05:00
Dirk Brandewie 6865fb658f x86: i2c: Move system binding code to dw_i2c.c
The code fragment to bind the instances of the I2C driver is not
platform specific but is driver specific.

All the information required to bind a driver instance comes from
CONFIG_ variables.  Having the binding code with the driver code
avoids duplicating the code fragments in each platform where the
driver may be used.

Change-Id: I9ea132c9340437ccb292bb8f3fa3d3a2b2a794db
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Dirk Brandewie f4ded7a0c1 x86: spi: Move system binding code to intel_spi.c
The code fragment to bind the instances of the SPI driveri is not
platform specific but is driver specific.

All the information required to bind a driver instance comes from
CONFIG_ variables.  Having the binding code with the driver code
avoids duplicating the code fragments in each platform where the
driver may be used.

Change-Id: Iff40227e3e25d431ae870d585445971f35d934dd
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Dirk Brandewie 586776f961 x86: gpio: Move system binding code to gpio-dw.c
The code fragment to bind the instances of the GPIO driver were being
replicated in every platform_config.c  This code is not platform
specific but is driver specific.

All the information required to bind a driver instance comes from
CONFIG_ variables.  Having the binding code with the driver code
avoids duplicating the code fragments in each platform where the
driver may be used.

Change-Id: Ie07a3d12d25201e82ce7074455e6c036f463851b
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Andrew Boie d5feec5c64 ram_console: driver for emitting console messages to a buffer
This buffer can be examined at runtime with a debugger to see what
is going on. Helpful if there are no other working console drivers
on the system.

Change-Id: I759467a57d16204b4b316c4f6fa8b7d5e1d1d236
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:17 -05:00
Ricardo de Almeida Gonzaga 0eb46fe0e5 gpio: fix interrupt callback call on gpio-dw
When configured as GPIO_ACCESS_BY_PIN, the callback should
be called only if the pin is enabled and received an interrupt.

Change-Id: I7addeb57c8d46dddc027e9b82a92654cd210ade1
Signed-off-by: Ricardo de Almeida Gonzaga <ricardo.gonzaga@intel.com>
2016-02-05 20:16:17 -05:00
Johan Hedberg 4cdcd228a2 Bluetooth: UART: Fix bt_uart_send error return values
The send() callback of HCI drivers should be returning 0 on success
and a negative value on error. The uart_fifo_fill() function returns
the number of transmitted bytes so it can not be directly mapped to
the send() return value.

Change-Id: I59be478c1985f44a46f2a9613f61471423b0e63a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Peter Mitsis e54276391b loapic_timer: rewrite tickless idle for loapic timer
Rewrites the LOAPIC timer tickless idle implementation to cover all edge cases.

Change-Id: Ide0a235f298dfc5c75a090a45d1bf8275d81e248
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:59 -05:00
Peter Mitsis 170b0c9251 loapic_timer: Rename global variables and routines
Renames the following global variables and routines to both improve
readability and comply with naming conventions:

Variables:
	counterLoadVal          -> cycles_per_tick
	clock_accumulated_count -> accumulated_cycle_count
	max_load_value          -> cycles_per_max_ticks
	idle_original_ticks     -> programmed_full_ticks
	idle_original_count     -> programmed_cycles

Routines:
	_loapicTimerStart()            -> timer_interrupt_unmask()
	_loapicTimerStop()             -> timer_interrupt_mask()
	_loapicTimerSetCount()         -> initial_count_register_set()
	_loapicTimerPeriodic()         -> periodic_mode_set()
	_loapicTimerOneShot()          -> one_shot_mode_set()
	_loapicTimerSetDivider()       -> divide_configuration_register_set()
	_loapicTimerGetRemaining()     -> current_count_register_get()
	_loapicTimerGetCount()         -> initial_count_register_get()
	_loapicTimerTicklessIdleInit() -> tickless_idle_init().

Change-Id: I2c1daa226d846e5be1aaad28d984d9f52bd02c00
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:59 -05:00
Peter Mitsis 00bb89357e loapic_timer: Remove tickless idle skew
Removes tickless idle skew calculation as it is not particularly useful.
The actual "skew" may vary wildly depending upon whether cache is involved
or not.

Change-Id: Ie5c966eba5cdc3cff2610d4c1f3bb673c83ec8b7
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:59 -05:00
Peter Mitsis da384d5610 timers: Fix _sys_idle_elapsed_ticks name in comments
Fixes two missed replacements of
    _SysIdleElapsedTicks -> _sys_idle_elapsed_ticks
in the timer drivers.

Both were previously missed due to typos.

Change-Id: If55c9624df6f3bd7188e249f74d3ee3de61a68e4
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:59 -05:00
Anas Nashif ebcdaf8ddd ia32_pci: HPET_TIMER depends on IOAPIC & LOAPIC
Change-Id: Id175712b88b434d9e3335f0736da8c2f04a95675
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:58 -05:00
Dirk Brandewie dbd25aeb3b x86: Change SHUTOFF_PIC to PIC_DISABLE
Make config variable name match the function.  The PIC is never turned
on in the zephyr code so there is nothing to shut off.

Change-Id: I1627e5a35cc37ef7959f36758c1e1aec03e22782
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:15:41 -05:00
Dirk Brandewie 7b3e7544d1 x86: move drivers to sys_{in,out} functions from PLB_* macros
These x86 drivers are the last users of the PLB_* macros change to use
the sys_{in,out} functions.

Change-Id: Iebd0ad1bf5e74379498f86b24d835a0430db1311
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:15:41 -05:00
Tomasz Bursztyka ad35e5dacf spi: Mask tx interrupt once over with any transmission
Or then the controller will spin around requesting to get its fifo
filled-in though it's unnecessary.

Change-Id: I81e7c483345236dee7691c3e780b1b06d6b2d0f8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:41 -05:00
Szymon Janc 109d6fb21b Bluetooth: Make bt_uart_open parameters explicit void
Change-Id: I87826f2ab662bb07428cb0ba1edded0ab26d2d5b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Johan Hedberg 49cc10dcfd Bluetooth: uart: Minor coding style fix
Change-Id: Ide37ce471d99e911507316ea720e7aaff1dac744
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:15:37 -05:00
Tomasz Bursztyka 9d0af1c270 spi: Intel spi driver fixes
- Handle the new error callback type, a ROR interrupt is irrecoverable.
- Removing the fifo pre-fill: this should never be done that way. It's
  up to the controller to request via an interrupt to get its fifo
  filled-in. (TFS bit on SSSR register is the one requesting such
  filling)
- Disabling the controller once completed (following transfer will
  re-enable it)
- Removing useless debugging info

Change-Id: I466a8efb65a41f3315a6a36e10ea519d0c4b01e9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:36 -05:00
Anas Nashif 71ad87c7d0 loapic: add LOAPIC_DEBUG for debugging loapic
Change DEBUG option into something more specific.

Change-Id: If1f421fbf7d234ad6bfac410697205d5d74548c0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:36 -05:00
Anas Nashif 476a823c94 loapic: cleanup comments
Change-Id: I98c5ffea85fb951d993bcb6f7f6fe305a419d03a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:36 -05:00
Anas Nashif a07a7903fd Remove serial options dependency on X86_32
Menu depends on X86, however some options are available
for all architectures.

Change-Id: I09cad39811319022d0323a4ff87d415346b5630a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:36 -05:00
Tomasz Bursztyka 7f84234892 ns16550: Use sys_io.h relevant functions depending on context
This will let us getting rid of old outByte/inByte functions.

Change-Id: I3344151c54f99e5e281ac8d3d027e0b810796111
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:36 -05:00
Tomasz Bursztyka a566afbebd ia32_pci: Add support for the designware i2c controller
Only 1 port is available on Quark through the PCI bus.

Change-Id: Ie0e0173686947134d2553dd0fd0230ffa5a1d456
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:36 -05:00
Tomasz Bursztyka 17c8f74859 i2c: Adding support for PCI enabled dw i2c controller
Since such controller is found on Quark x1000 (Galileo, ...), it will
need to get configured and/or enabled through PCI.

Change-Id: I16d00364edcb17653eaaf073e87b4e5850de7299
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:36 -05:00
Dan Kalowsky 7958f22acd i2c: converting to sys-io functions
Using the OS provided sys-io functions for access to the registers
and lower level devices.

Change-Id: I1a88786189cbed0965f84146ffad9988a3b68a7b
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:15:36 -05:00
Dan Kalowsky 998cc8e3d4 i2c: import of Synopsis DesignWare I2C
Initial import of Synopsis DesignWare I2C driver functionality
for the Zephyr Project.  This import has been tested for host
master control.  While it does contain the code to work as a host
slave, this code has not yet been completely tested and validated.

Change-Id: I3df0214f6e3b6798f7dad4819d09c3ec5998e508
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:15:36 -05:00
Dan Kalowsky 1f63fb5de4 i2c: Adding makefile to build code
Adds the necessary changes to Kbuild and Makefiles to enable I2C
driver support to build.

Change-Id: I3113ccbbbbb4e06ef134ca73f509d2755a2abb59
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:15:36 -05:00
Tomasz Bursztyka cb1774c548 gpio: Correct the PCI pre-set informations
- Device ID was wrong
- Setting default class id

Change-Id: I9fd1df284eca4067c21beffa7599307a40be5144
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:36 -05:00
Tomasz Bursztyka 26581d1c82 gpio: Remove a useless local variable
A fix for a mistake introduced in commit 1a7357.

Change-Id: I411937c85f29abb934ae5385f4858950f5d76887
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:35 -05:00
Tomasz Bursztyka edb863c79f pci: Removing bogus and finally useless optimization
No need to keep track of PCI class's bus and dev. First, there might be
more than 1 bus and/or 1 device which would hold the same class.
Secondly, with the new PCI_ENUMERATION option, enumeration PCI device is
now optional and it's advised to unset such option and statically
configure the PCI information of the devices (to gain in booting time
and code size). So finally removing all of this.

Change-Id: I395d08c8f6f5e76431af59aa6fc9b30d703f2e75
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:35 -05:00
Adrian Pochiu 70603a5144 Add option to enable HW flow control for UART
Change-Id: I151b3c6516b9b5a38ab0da2948c951eb69d57498
Signed-off-by: Adrian Pochiu <adrianx.pochiu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:35 -05:00
Anas Nashif 03351519ee kconfig: move UART_INTERRUPT_DRIVEN into serial options menu
Move UART_INTERRUPT_DRIVEN under options menu

Change-Id: I56e8447140956d2fe21fe138c0fe36b8407fdaa7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:35 -05:00
Dirk Brandewie 0a7e4d1b9b Fix arc interrupt configuration
The _ARC_V2_IRQ_VECT_BASE register must be set to the vector table in
flash.

Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Change-Id: Ied5451c98222f545cd669967023aef26c3d8e48e
2016-02-05 20:15:35 -05:00
Tomasz Bursztyka 1e006d8146 pci: Fix a vendor/device id bug where only one might be wrong
Only one wrong is sufficient to fail the test: the found device is not
the one we are looking up to.

Change-Id: I2a54b5683fedf7d54de1e1553aecba40b6b6b2e1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:35 -05:00
Tomasz Bursztyka 1780da4151 pci: Add the bus and device informations to the debug output function
This will help when debugging, since there might be different bus and
device on the same target.

Change-Id: I886a256f14a960d2faed71561416ee3bee20af1e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:35 -05:00
Peter Mitsis d50f786145 doc: Rename quark platform configuration to galileo
Updates the documentation as the quark platform configuration had been
previously renamed to 'galileo'.

Change-Id: I31e1920f30f57b243b07215fe92be08b5e5c9d59
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:33 -05:00
Tomasz Bursztyka eb6ed6bb0d gpio: Enable PCI support for the designware gpio driver
This will enable the possibility to use this driver with Quark X1000.

Change-Id: Ic40b750d608488e97cc7662cad6c6d66dbf428ab
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:32 -05:00
Tomasz Bursztyka e7c8bf43ac gpio: Make use of sys_io functions in gpio-dw driver
Just to align the code to generic memory mapped registers and bit
operations functions.

Change-Id: I0fe8b3b6687670d0ed0daffe52645ec2c6b4c674
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:32 -05:00
Anas Nashif 2b6ded2b7f gpio: declare api function struct as static
Change-Id: I04ce07587845a6db555f4033b3a6f2d2c622fe57
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:32 -05:00
Juan Manuel Cruz 5ad14313bc gpio: Fix designware's driver set bit function
This commit fixes the set bit function.
If the value to set is different from zero, then
the indicated bit will be set.

Change-Id: I9c42f683d108b371ca821f446ac5a10541b89b9f
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:15:32 -05:00
Dirk Brandewie 77a78f0827 gpio: Add driver for Synopsys DesignWare GPIO devices
[DL: captilize commit message title; fixed some whitespaces;
     changed the __initconfig_gpio_* from level 0 to level 1,
     which is the level of pure_init; and added include path
     to board.h; ]

Change-Id: I7eea6a6ca9e4b7cf8d1ccabb57f07f786da93ef0
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:32 -05:00
Tomasz Bursztyka 1e39d6274b uart: Properly integrate driver config within PCI context
- Makes the code simpler in driver side
- Configuration is done on platform's config.c file and not the driver
- Handles CONFIG_PCI_ENUMERATION setting

Change-Id: I9b8376cebd7e0b62279251da132a2c4ee7b2e148
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:32 -05:00
Tomasz Bursztyka e4479cd0cf spi: Handle the support for PCI_ENUMERATION
Without it, it won't go through a pci scan, and will just trust the
pre-set information for the bus/dev/function to enable the memory
mapped registers.

Change-Id: Ica9156be541619dce9684dd45f70e05b69782a7c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:32 -05:00
Tomasz Bursztyka ff3f81b44c pci: Make use of pci_show without #ifdef
This will make code that use it not too crowded with #ifdef #endif

Change-Id: Iec0fa662445b1cefdc7c64d9483e1ae483106a90
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:32 -05:00
Tomasz Bursztyka 018bcfe8d4 pci: Add an option for enumerating PCI devices
This option will be used to disable PCI enumeration (not PCI bus) to
gain in code size and execution as long as driver will be properly
configured statically. Thus setting this option as set by default.

Change-Id: I7da5d154c8ee89e44fc2bad8e85a5a20f498927e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:32 -05:00
Tomasz Bursztyka 3e32b29f57 spi: Fix the case when PCI is not in use on intel driver
Change-Id: Id1c5f259e6788d8cba024139e710db9c9d78d943
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:32 -05:00
Tomasz Bursztyka d96943b04c spi: Add support for Intel's SPI controller
Such controllers are found in Quark's X1000 series, and thus are found
on Galileo boards v1 and v2.

Change-Id: Ib71486c9f27de1b6c48ce3cb3dd138d69833c2ea
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:28 -05:00
Tomasz Bursztyka d5d525562e drivers: Add the common directory and files for SPI
Add the necessary Kconfig, Makefile etc...

Change-Id: I3682ab353ef71f3827520ab3fc4b16a122180d99
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:28 -05:00
Tomasz Bursztyka 7b34e0dcfa pci: Add helper functions to enable mem mapped registers
This will be useful to enable memory mapped registers for PCI based
drivers that requires it. Removing redundant setting as well.

Change-Id: I52e47d01263a2de31c0c9f52ff65cc7e2734cf08
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:28 -05:00
Tomasz Bursztyka ff39559146 pci: Add support for filtering by function
This will be useful for PCI based drivers to integrate fully within
the device driver model, where they will have to provide the function
they are found.

Change-Id: I7d64a4c6727cee52cbcb743c859cda43ac1a853b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:15:28 -05:00
Yonattan Louise d2108bf084 Profile interrupt events.
Add the interrupt profile points for x86 and ARM arquitectures. This
gives information regarding the time when interrupts occur.

Change-Id: Ic876c0e7f9e8819d53e0578416f09146f4456d3d
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:15:28 -05:00
Daniel Leung dc601ab468 simple: uart: fix reference to uart_devs
The uart_devs in platform config files have been converted to pointers
to struct device. This change is missing in the simple UART driver.

Change-Id: I8107f9e78daeeb3878140506f51bbd0025fde05b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:27 -05:00
Benjamin Walsh bb2ba33f10 sys_clock: move [nano|task]_cycle_get_32 to drivers
The drivers provide _sys_clock_cycle_get(): moving the public APIs to
the drivers allow them to be aliases of it.

Change-Id: Ic5975a048f2b51f94510f0c3cd5e6ab3a8907718
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:27 -05:00
Benjamin Walsh 87eeaa3249 sys_clock: rename timer_read to _sys_clock_cycle_get
Follow coding conventions.

Change-Id: I3ca5d1cf4eaacfc09d5e8c44c49be447549537c8
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:27 -05:00
Daniel Leung e180fa0ff4 serial: stellaris: cosmetic changes to comments
Converts the file description to doxygen format, and updates
the information inside. Also removes empty lines.

Change-Id: I3866843a31e30e1dd464b27cafc830900d8dce4f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:26 -05:00
Daniel Leung 3104503d25 serial: stellaris: clean up camel case and function declarations
Clean up variables and function arguments to conform to coding style.
Also align the function argument list.

Change-Id: I49eff429bfa369c8a544d8171e35a41523995aa3
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:26 -05:00
Daniel Leung bd2e264d26 serial: k20: cosmetic changes to comments
Converts the file description to doxygen format, and updates
the information inside. Also removes empty lines, updates
the comments for function, and adds missing comments.

Change-Id: I7610e8667cd85feb0c4c853b44880f7e29b6c05a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:26 -05:00
Daniel Leung e424f1bee1 serial: k20: clean up camel case and function declarations
Clean up variables and function arguments to conform to coding
style. Also align the function argument list.

Note that this only changes the parts related to UART.

Change-Id: I84a6ba88963784f6ddc77d5bda653a7d2de6a72b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:26 -05:00
Daniel Leung 7f07e50aa3 serial: ns16550: cosmetic changes to comments
Converts the file description to doxygen format, and updates
the information inside. Also removes empty lines, and updates
the comments for function.

Change-Id: I97672996510fec1c92a30f78d6f088f02279fb44
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:26 -05:00
Daniel Leung 44d4c2277a serial: ns16550: clean up camel case and function declarations
Clean up variables and function arguments to conform to coding
style. Also align the function argument list.

Change-Id: I0787558abe899e9376ede0ee5c5ac5728c42254d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:26 -05:00
Dmitriy Korovkin 35e31e9c0c Fix level triggered interrupt handling
Fix the option that enables level triggered interrupts usage.
It depends on CONFIG_HPET_TIMER_LEVEL_HIGH and CONFIG_HPET_TIMER_LEVEL_LOW
configuration parameters.

Change-Id: I3529b1e57b1625e6f0f4b05d9c15eb563e9c4f83
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:15:26 -05:00
Dmitriy Korovkin 93b0ced44b Order hardware and device initialization
The initialization procedures need to be called in the
following order:
- basic hardware initialization;
- devices initialization;
- hardware clock initialization, that the kernel needs to
  run the kernel server.
This way, the board initialization routines is placed
to the pure_early_init level to make sure it runs first,
all device initialization procedures run at pure_init level,
so they are initialized early enough to be used for debugging
if needed. Hardware clock initialization is placed on
nano_early_init level to make sure hardware clock is initialized
just before the kernel server starts.

Change-Id: Ieecf9f0252c47c621b7208969687dc1113fc2ad0
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:15:26 -05:00
Daniel Leung e564035521 serial: rename struct field int_pri to irq_pri
This is just a cosmetic change to unify anything interrupt related
under 'irq'.

Change-Id: Ib8804d194e11eb49526fda952d9efc0f2ffac2df
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Daniel Leung d8f10f4c01 uart_console: make baud rate configurable
Move the baud rate selection for uart_console into Kconfig.
This allows apps to specify custom speed. Default is 115200
which should be supported by almost all RS232 and USB adapters
out in the past few years.

Change-Id: I78649bf2a1b2ddfc90a20d611a6454e3ad3b1b3a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Daniel Leung 40147440f5 serial: utilize dev->driver_api for new driver model
This is the final step to convert serial to the new driver model.
The dev->driver_api is now being used by individual drivers.

As a side effect, it is now possible to build multiple serial
drivers in the final image (though it won't make much sense).

Change-Id: I5d864e6503a5431b29006c311320155adf81cf5b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Daniel Leung c384571add console: uart_console: introduces CONFIG_UART_CONSOLE
This introduces the config option CONFIG_UART_CONSOLE,
and also CONFIG_CONSOLE. The UART console can finally
be disabled if desired.

The defconfigs are also being updated.

Change-Id: I5ebaf6471986deca105971e67fcddb43374de94a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Daniel Leung ad2d29689e console: uart_console: decouple uart console init from UART init
With this, the UART console has its own initialization which is not
dependent on UART init routines.

This will allow the app to utilize all UARTs for other purposes,
instead of always reserving one for console. Future patch
will enable this choice.

Note that the console init is effectively demoted to pure_init
from pure_early_init. The UART console depends on UART being
initialized, but there is no deferred init at this point.
So this initializes the console a bit later than UARTs,
simply to make sure the UART is initialized before using it.
Once there is a mechanism for some type of deferred initialization,
the UART console init can be promoted back to pure_early.

Change-Id: Iba95197b13384cb1a46e34c78638348b7a0bec8c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Daniel Leung 2fd29e2667 serial: converting to new driver initialization model
This restructures the device structs and now utilizes the new
driver initialization model. This is another step towards
converting the serial driver to the new driver model.

Note that the serial driver does not initialize the hardware
unless it is being used by another driver. The configuration
of the serial port needs to be done by the driver utilizing
the port (e.g. baud rate, interrupt priority, etc.).
Therefore, some serial ports are declared but not exactly
configured.

Also note that the UART console is being initialized at
the same time as the serial port. This will be removed
in future patch, so the UART console driver will do
its own initialization.

Change-Id: Idd89954b2d0649a557ba8c869ee96512fec898e4
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Daniel Leung 199c47987f serial: introduce CONFIG_SERIAL
This encapsulates the whole serial drivers Kconfig sections, and
allows the whole section to be deactivated.

Change-Id: I84f8d35da74f3c00a44d8c17786ea2297422d68b
Signed-off-by: Daniel Leung <danielcp@gmail.com>
2016-02-05 20:15:25 -05:00
Daniel Leung 0f7a78ce1b bluetooth: move static device definition to platform configs
This moves the static device definition from the driver file,
drivers/bluetooth/uart.c, into the platform config files for
each platform.

This is another step towards converting UART drivers to
the new driver model. Also, platform config files are a more
logical place for the definition.

Change-Id: I668a52de5a38005b8b2bcb67d74437ead377cb16
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Daniel Leung a4212108f7 serial: remove unused CONFIG_EXTRA_SERIAL_PORT
Change-Id: Ibb8ffcd377d9b7c34370c522fb06ce797f4feaed
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Daniel Leung 1ad2a56ee3 serial: rework functions to use struct device...
... instead of an array index to a global array. This is
an intermediate step to make the drivers conform to
the new driver model.

This only changes from using a direct array index to using
device structs. The UARTs are still staticlly defined.
Later patches will make the drivers utilize the driver
initialization procedure specified by the driver model.

Change-Id: I18041bbb4b0efdf8ae87088fd000b391d0827e9b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh 1bab46dca1 ffs: rename find_[first|last]_set to find_[lsb|msb]_set
The new names reflect better what the functions do: they find the first
bit set starting from the least or most significant bit, i.e. they find
the least or most significant bit set, in a 32-bit word.

Change-Id: I6f0ee4b543f6f37c2f08f7067e14e039c92a6f6a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh c4ad73d3b6 ffs: do not use _inline versions of find_[first|last]_set
Standardize on using the find_[first|last]_set (non-inline) symbols
everywhere.

The non-inline versions provide absolutely no benefits, so they will be
removed in a subsequent commit, and the inline versions will have their
_inline suffix removed.

Change-Id: I5b3dee33ffe3878a05e1bb3c6400a8d8c1640ad4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Anas Nashif 45a387fc46 ioapic: cleanup code comments and doxygenize the file description
Use doxygen format for file documentation and move 
parameters to be part of the function comments.

Change-Id: I01c0614e7cd3ef4c689d2aec3aa3e52e0d21ffcd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:20 -05:00
Anas Nashif 8cc32b8209 Enable IO-APIC debgging
Change-Id: I4f6c4400ec24d424b481703711d70bb5aff4f7e3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:20 -05:00
Peter Mitsis c963861d47 Remove PIC code, but not PIC disabling code
Removes the non-PIC disabling PIC code as the PIC is not a supported interrupt
controller.  The PIC disabling code remains as it is needed to prevent the
generation of spurious interrupts from the PIC (see CONFIG_SHUTOFF_PIC).

Change-Id: Ic59aa17ab96f34685a5d7b5f24cab391de47edca
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:20 -05:00
Peter Mitsis dba5ac622c Remove PIT code
The PIT is an unsupported device.  On x86 based platforms, the LOAPIC_TIMER and
HPET_TIMER are the only supported timers.

Change-Id: Ic890838c811b7eb62008aef0c8a92786f1579217
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:20 -05:00
Peter Mitsis dbaa4a45ed Use LOAPIC and IOAPIC Kconfig options
Removes the LOAPIC and IOAPIC macros from board.h as they are no longer
appropriate since Kconfig options exist to use in their stead.

Change-Id: I2ce41a7a08d1859682389f35cd5a97c0e2cd5bf7
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:20 -05:00
Peter Mitsis 2db3db4ce2 Create IOAPIC and LOAPIC Kconfig options
Creating the IOAPIC and LOAPIC Kconfig options permits future commits to remove
those settings from the relevant board.h files.

Change-Id: Ie33c703f39c68d6e251d67b1c7cf75a0dd56a7e6
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:20 -05:00
Peter Mitsis 658bb54ed1 Use LOAPIC timer Kconfig options
Removes the LOAPIC timer macros from board.h as they are no longer required
since appropriate Kconfig options exist to use in their stead.

Change-Id: Id0b509eba7cce1839b400f95b989bf886322e1a8
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:20 -05:00
Peter Mitsis 32fd4dc25c Create LOAPIC timer Kconfig options
Creating the LOAPIC timer Kconfig options permits future commits to remove
those settings from the relevant board.h files.

NOTE: No defconfig files have been modified as the LOAPIC_TIMER configuration
option is not enabled in any of them.

Change-Id: I7d97ed089cd4b734566b698183be95d3a166d71f
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:20 -05:00
Peter Mitsis be211ba91c Fix LOAPIC timer comments
Fixes a copy-paste error that inadvertently had the LOAPIC timer being
referred to as the PIT.

Change-Id: I4760d150cd6feb76b7d7384845898c6276bace83
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:20 -05:00
Peter Mitsis b643468280 IOAPIC defaults to y when LOAPIC is enabled
For as long as the IOAPIC and LOAPIC code is coupled (as it currently is),
enabling LOAPIC must select IOAPIC to be enabled as well.  If future commits
separate the two, then the "select IOAPIC" can be dropped.

Change-Id: Ibe7e6b86e5add19b8b3cc68ebecce760d8914c86
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:20 -05:00
Peter Mitsis 578d417e87 Use HPET timer Kconfig options
Removes the HPET timer macros from board.h and uses the HPET timer Kconfig
options in their stead.

Change-Id: Ia0b3cd87716277ac25f12deb31d5c5934f355050
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis 366962557c HPET: Add additional Kconfig options
Adds additional Kconfig options to the HPET timer for setting its base address,
IRQ, IRQ priority and condition for triggering an interrupt.

Change-Id: I80349c60237380129da9ef41ccf6850c6b874c3c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Anas Nashif d2fff1fb7a drivers: use subdir-ccflags-y for all drivers
All driver Makefiles are adding the same cflags and they
have been done inconsistenly, make all drivers inherit
from the top level Makefile and remove unused includes.

Change-Id: Ie66d0ba7a418ac26f7eb709f50c887dc682e935c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:19 -05:00
Anas Nashif abb4404689 Move PCI settings to drivers/pci
Change-Id: I92ccbcdd1292f8f4f017b45968c2204c06e6f73e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:19 -05:00
Benjamin Walsh ac60583b76 drivers: rename cortex_m_timer to cortex_m_systick
The name of the device is SYSTICK. The device name should be part of the
file name, like all other timer drivers we support. The name
'cortex_m_timer' said nothing about which device the driver is for, since
it's way too generic: it could be for any timer present on any Cortex-M
board.

Change-Id: I39b4f79c32516ec9aff82c55c0ca639fad1b52bb
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:19 -05:00
Benjamin Walsh 6ebb212e18 ioapic: remove comment about split kernel
The Zephyr kernel must always be built as a monolithic image, not as
separate nanokernel and microkernel images.

Change-Id: I44fdd2349b32f409c84710f58bc4b3fe96fd79b7
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis 2a4a6cf578 Remove references to BSP from drivers/ directory
Removes references to obsolete BSP terminology.  Where appropriate, replaces it
with platform terminology.

Change-Id: Ifb17f98bc12d3a28198810351629a109abdc18a5
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Dmitriy Korovkin 8b0271dd2c Adapt HPET driver to work with QEMU
Qemu implements HPET so that it is connected to IRQ 2, which makes
necessary to use it in legacy emulation mode.

Add legacy emulation mode to HPET driver.

Change the way the HPET driver is initialized. QEMU requires that
the mode (one shot or periodic) gets set prior loading comparator
value.

Add debugging mode to HPET driver to ease the next port.

Change-Id: I668325d5968451585519a08b6c41863cf6e37f88
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:42 -05:00
Dmitriy Korovkin 63fe84bdaf Fix PIC shutoff.
Disable the PIC upon initialization to prevent it from
generating spurious interrupts.

Change-Id: I08ba1d00e269e1fd1d32960dcb844e9fa1ccc195
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:42 -05:00
Peter Mitsis d2857404f5 Kconfig: fix SYS_CLOCK_HW_CYCLES_PER_SEC dependencies
Fixes the SYS_CLOCK_HW_CYCLES_PER_SEC Kconfig option dependencies such that
it can be overridden by a modified platform configuration file.  This is
particularly important for the LOAPIC timer driver as
SYS_CLOCK_HW_CYCLES_PER_SEC is dependent upon the target's CPU/bus frequency.

Change-Id: I0fb49b4c540888cb1988c76e2a711a85e756f82c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:42 -05:00
Peter Mitsis d8a5c03404 Kconfig: Update timer driver dependencies
Updates the timer driver dependencies to simplify the selection of a timer
driver.  The timer driver menu only lists those drivers that are compatible
with the previously selected interrupt controller.

Change-Id: I5deea315f7c373c6660bacc411c6374e7b0ae84d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:41 -05:00
Peter Mitsis dff49566e0 Kconfig: Update CONFIG_IOAPIC dependencies
Selection of the IOAPIC requires that the LOAPIC be previously selected.

Change-Id: I13d95d4bb4ff02c1aebb0b5e573cb2b89dbe530b
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:41 -05:00
Peter Mitsis 61f0ce44c7 Kconfig: Remove option LOAPIC_TIMER_FREQ
The LOAPIC_TIMER_FREQ Kconfig option is not used.

Change-Id: I919fd2128f667e0b91467cb542041449738dd992
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:41 -05:00
Peter Mitsis dc0fb7ed38 Cosmetic: Fix whitespace in timer driver Kconfig
Change-Id: I2d44567756faee030a26004973ad8c306a47bbcd
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:41 -05:00
Peter Mitsis 53b721a706 Cosmetic: Fix whitespace in interrupt controller Kconfig
Change-Id: I2eb4184189925bcfe433617286a364dc1e35100c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:41 -05:00
Peter Mitsis 2871ca32d3 Rename x86 platforms
Changes the the names of the x86 platforms so that they are more generic.
  generic_pc -> ia32
  quark -> ia32_pci

NOTE: it is expected that the two platforms will eventually be merged into one.
one. At present, the two platforms support different hardware.  For example,
the ia32 supports bluetooth whereas the ia32_pci does not, and the ia32_pci
supports both PCI and HPET whereas the ia32 does not.

Change-Id: I8a980aaef55be8c59f7d19ddeb7fafbf11253408
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:39 -05:00
Peter Mitsis 213db12fbf Move platforms to new arch/<arch>/platforms directory
Change-Id: I9ad5d51329d381c091aa47b482a8e38e7c194118
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:39 -05:00
Peter Mitsis 7e28edbc96 Generalize interrupt_controller include path
Improves code consistency by abstracting the architecture directory in the
set of assembly include paths.

Change-Id: I4b3638419a1242cb0628f128c5e3b82c3357d83c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:39 -05:00
Dirk Brandewie fce979ef3e init: Change _InitHardware() to be called from init system
Change the function signature of _InitHarware() function and rename
the function to a platform specific name now that it will be called
via a function pointer and not by name.

Call the platform *_init() function at PURE_INIT time.

Change-Id: I5168dfea81f406da135d491a2b4a24e8255f418a
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:14:37 -05:00
Peter Mitsis 03ab32a66a Microkernel timer uses new driver initialization
Update microkernel systems to use the new driver initialization model on the
timer driver.

Change-Id: Ida9ef2a395d0dddf4104d490d78b13b11ea3c347
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:37 -05:00
Peter Mitsis 27e01a060a Nanokernel timer uses new driver initialization
Update nanokernel systems to use the new driver initialization model on the
timer driver.

Change-Id: I22d8619f56052f094482d73ab34c9d610492d8c0
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:37 -05:00
Peter Mitsis 6e95fe0356 Update _sys_clock_driver_init() interface
Prepares the _sys_clock_driver_init() routine to interface with the new driver
model.  To this end, it must accept a pointer to a device structure and return
an integer.

Change-Id: I3c600ce1efb49c0864aae7b09663ca40d6289372
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:37 -05:00
Anas Nashif d89bcd300c doxygen: change comment style to match javadoc
Change-Id: I5266caff9ef2ee26c556f6e144eca020ae9169bd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:33 -05:00
Peter Mitsis 1bafa75ef1 Rename timer_driver() to _sys_clock_driver_init()
The revised name conforms to Zephyr OS naming conventions.

Change-Id: I5bcdaf1df7da9d8ce5787a08b29ead91dd8f24ce
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:33 -05:00
Peter Mitsis 136bef3c5d timer_driver() no longer takes a parameter
Removing the parameter to timer_driver() as it is not used.

Change-Id: I09275287eeb541be0dd315056b4f2bc6cbc2573c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:33 -05:00
Anas Nashif f367f071b6 doxygen: add @brief and capitalize
Remove function name from comment and add @brief instead.
Also capitilize first letter.

Change-Id: Ib708b49bf02e5bc89b0066637a55874e659637e0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:33 -05:00
Anas Nashif 1362e3c162 doxygen: RETURNS: -> @return
Previous comment style used RETRURNS:, use @return to comply
with javadoc style.

Change-Id: Ib1dffd92da1d97d60063ec5309b08049828f6661
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:32 -05:00
Anas Nashif ea0d0b220c doxygen: change comment style to match javadoc
The change replaces multiple asterisks to ** at
the beginning of comments and adds a space before
the asterisks at the beginning of lines.

Change-Id: I7656bde3bf4d9a31e38941e43b580520432dabc1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:32 -05:00
Anas Nashif 8d879a5c32 define UART_CONSOLE_INDEX using Kconfig
Use Kconfig to define this variable and remove its
previous definitions from board.h. This will simplify
creation of different variants from a single platform.

Change-Id: I0aaa5aa81dedf096c6d8c1ea2d509c71817336d3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:27 -05:00
Peter Mitsis d5f926fb4d Relocate Cortex-M timer driver
Moves the Cortex-M timer driver so that it resides with the other timer
drivers.

Change-Id: I3324c53356efd9f5fd88752a98e4ae301ea38d47
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:27 -05:00
Peter Mitsis 10a56b5a00 Add CORTEX_M_TIMER Kconfig option
Adds the Kconfig option for selecting the Cortex-M systick timer.  This helps
pave the way for moving the Cortex-M systick timer into the drivers/ directory.

Change-Id: Iee040083a425c9c1dbc5973991b89239e0a72eee
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:27 -05:00
Peter Mitsis 1ffabeaf3d Rename BSP_DIR to PLATFORM
Updates references to CONFIG_BSP_DIR to CONFIG_PLATFORM as part of the
BSP -> platform clean up.

Note that despite the renaming, the usage of the config option remains
unchanged.

Change-Id: I2846c3f761cf09871019c0855bf1824ae03e6b3c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:27 -05:00
Anas Nashif e943f69950 kconfig: move serial port options to drivers/
We had those options defined per BSP. Moving them
to a more generic place makes more sense. In this case
they are moved under serial drivers.

Change-Id: I8faf31321fc433eaa168bf36f2b590a6b8402f9e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:26 -05:00
Anas Nashif 1371d5e25e arc: move arc NSIM to drivers/
Change-Id: I5c92ec6a49d24737367ee874280aef10fab05d79
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:26 -05:00
Anas Nashif f547c36df8 arc: move arc timer to drivers/
Change-Id: If4dccbf3bbe67c89b69aed1d62025bf867405d22
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:26 -05:00
Anas Nashif 08f8b65f25 arc: move interrupt controller to drivers/
Change-Id: I731c99062f4b5d2d4d1eb6a3c546ed5f3e494fa4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:26 -05:00
Allan Stephens 478128cf9e Rename kernel's clock_vars.h to sys_clock.h
The revised name better reflects the fact that the file defines
macros in addition to declaring variables. In addition, most of
these APIs use the "sys_clock_" prefix, which aligns well with
the new file name.

Change-Id: Ib33517d4b19ec2455303b87200c677e87640fcbc
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:26 -05:00
Dmitriy Korovkin 8d065343c2 Use static interrupt registration in device drivers
Make device drivers use static interrupt registration procedure.

DYNAMIC_INT_STUBS configuration parameter was used only by device
drivers to switch between static and dynamic interrupt registration
procedures. Now it is obsolete and is removed.

uart_int_connect() function is removed. If UART device driver still
needs to register interrupt dynamically, it should use
irq_connect(uart_irq_get()).

Change-Id: I80c695f337456e9b0c1b0fd56716e35794f7bdb7
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:25 -05:00
Dmitriy Korovkin b1b20e4129 Conditional build of bluetooth driver uart component
UART bluetooth driver build depends on CONFIG_BLUETOOTH_UART.

Change-Id: I95561f8daef494507e65e7977f444d861f2dac74
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:25 -05:00
Dmitriy Korovkin 660878e4e2 irq_connect for x86 uses static stub array
In order to provide the same irq_connect() on all platforms
on x86, irq_connect() now uses a static array of interrupt
stubs. Device driver does not need to provide interrupt stub
to irq_connect() function.

Add NUM_DYNAMIC_STUBS configuration parameter, the number
of interrupt stubs used for dynamic interrupt registration.

Modify tests for unified interrupt register API

Tests that deal with interrupts are modified to work
with the new interrupt registration API.

Add CONFIG_NUM_DYNAMIC_STUBS option to dynamic interrupt projects

Projects that use dynamic interrupt handler registration on x86
have to include CONFIG_NUM_DYNAMIC_STUBS parameter in the
configuration.

Change-Id: Ic90c726485521a57cf695fd3edc8cac85d0b827d
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:25 -05:00
Dmitriy Korovkin 6dd108a263 IRQ_CONNECT_STATIC implementation for x86 platform
In order to simplify x86 interrupt stub creation, each interrupt
controller implements an interrupt stub definition macro.

Add IRQ_CONNECT_STATIC() for static interrupt registration, and
construct the interrupt stubs name from device and interrupt
handler names.

Add IRQ_CONFIG() macro for the interrupt controller configuration.
On x86 platform it programs APIC to associate an IRQ number with
the interupt vector.

Add HPET_TIMER0_INT_PRI parameter to Quark platform header to
make it build correctly.

Change-Id: I24ad25e1aa807ffa63733a27ad882877fcad72af
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:25 -05:00
Johan Hedberg 9bea2c3cfc Bluetooth: Move HCI driver API to dedicated header file
This makes it clearer that this is a specialized API not intended for
general app usage (unlike most other things in bluetooth.h).

Change-Id: I0ce1d5903610a9b3a99cf0be9f0e1462b04bf45a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg 939544b75d Bluetooth: Move logging helpers to a dedicated header file
To make it clearer that these helpers are intended only for
Bluetooth-subsystem internal code, move them to a separate file.

Change-Id: Iea64780f5c61c1c96e12c9df378676bc49498fe4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Anas Nashif efeb26757e random: include bsp directory when building driver
Change-Id: Ia0e6a511bba47aa5bdf6e6c489055a71d6a78d79
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:23 -05:00
Anas Nashif 9485729b3a Rename *.s files to *.S
Change-Id: I706a06e287f9e8e52c1cee4863c36673b21762f7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:21 -05:00
Dirk Brandewie 02ef939831 x86/bsp: move timestamp "random" driver to drivers/random
Change-Id: I7a7e7627f1ef60c652c15ad482a4f84f00d79c44
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:14:21 -05:00
Dirk Brandewie 11edf422b4 x86/bsp: move local apic timer driver to drivers/timer
Change-Id: I74f7297d21f3acf4a457ca335162602b35f4f6c1
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:14:21 -05:00
Dirk Brandewie 73d74a5abb x86/bsp: move hpet driver to drivers/timer
Change-Id: I63c361a586d2fd8c03674febd58bc1dfd2658fdc
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:14:21 -05:00
Dirk Brandewie 09d2770377 x86/bsp: move io apic driver to drivers/interrupt_controller
Change-Id: I00f400e0405f526dd17cf22c703fab4a4968fce0
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:14:21 -05:00
Dirk Brandewie 124a27f210 x86/bsp: move local apic driver to drivers/interrupt_controller
Change-Id: I69350493c3b94d754f89fb37eaebe50a8076384b
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:14:21 -05:00
Dirk Brandewie 526e132eb1 x86/bsp: move PIC (i8259) driver to drivers/interrupt_controller
Change-Id: I383424667f291ad4985781a7e6566c01c76ba5e0
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:14:20 -05:00
Oleg Zhurakivskyy cf59dda4a5 Fix compilation with CONFIG_DYNAMIC_INT_STUBS
Change-Id: I153747d441e8efe7a2941b01ef0cedda7e58237c
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2016-02-05 20:14:20 -05:00
Szymon Janc b70ba38325 drivers/simple: Use ccflags-y instead of EXTRA_CFLAGS
According to section 3.7 of Documentation/kbuild/makefiles.txt, using
EXTRA_CFLAGS in Makefiles is "still supported but their usage is
deprecated."

Change-Id: Iec6121b6b79a6a8c58ac26b8b08a542eac575c22
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:20 -05:00
Allan Stephens 893726ccb6 Eliminate duplicate registration of system tick event handler
Since the system generator pre-registers K_ticker as the handler
for the system tick event, there is no need for the timer driver
to re-register it at run time.

Change-Id: I7f20c19e5c6ccc7dfb6117aa2d2647b9dec0e549
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:19 -05:00
Johan Hedberg 68773aa74e Bluetooth: Fix CONFIG_BLUETOOTH_DEBUG_UART dependency
The BLUETOOTH_DEBUG_UART config option should depend on BLUETOOTH_UART
and also be sorted after it in the hierarchy.

Change-Id: I3e049e52c2e353cd0c6f1a99ca8934a289e0cce8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:17 -05:00
Andrei Emeltchenko 1c65da5ed7 Bluetooth: Check returned buffer is not NULL
Buffers returned by bt_uart_evt_recv() and bt_uart_acl_recv() may be
NULL in theory. This makes code consistent by checking return value.

Change-Id: Id39def39c8b1c4c6eefc7b2bf01702c54b3e565c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:14:17 -05:00
Anas Nashif 54ac4484d7 Rename VXMICRO_ARCH and VXMICRO
Change-Id: I6f3858de98333ec466aa876c5f2887faa8e276e2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00
Szymon Janc 6d27b0a33c Add simple UART driver
This driver is a very simple UART driver that can be used to implement
a protocol in application. It has no protocol logic and just allow
application to receive and send data over UART in platform independent
manner.

API is designed to minimize number of required memory copies.
Application is able to provide new buffer every time it decides to
consume received data. It is also able to just alter offset and
reuse current buffer eg if data was corrupted or otherwise invalid.

Change-Id: I8d3827fe2e242196e986d0419bc5487357481558
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:16 -05:00
Allan Stephens 5189844df5 Eliminate VxMicro branding in kernel code
Eliminates references to the obsolete OS name. In most cases the
name is simply removed, as it isn't necessary.

Change-Id: I32f9e7390e436aec008a9454b72657e129d65152
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Allan Stephens bb9ab0322e Eliminate unnecessary references to cpu.h and cputype.h
Gets rid of places where there is no need to include these files
at all, or places where these files are being indirectly included
due to the inclusion of nanokernel.h.

Change-Id: I7b58148af454b977830c00a6b519a78d0595603b
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:14 -05:00
Allan Stephens a1bd59de35 Eliminate obsolete coding convention comments
Gets rid of single-line comments required by a previous set of
coding conventions. These comments provide no value to readers
and just clutter things up.

Change-Id: I2a08b12cf5026253de56979efdfc510e7e68defe
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:14 -05:00
Peter Mitsis 6232a85059 Fix closing CONFIG_MICROKERNEL block comments
Closing comments to two CONFIG_MICROKERNEL ifdef blocks incorrectly identified
the ifdef block as NOT belonging to the microkernel.

Change-Id: Iee415e33d7f8a88c41009c5783b37da3a431461b
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:14 -05:00
Anas Nashif bbe84f8ae5 Use ccflags-y and asflags-y instead of EXTRA_CFLAGS
According to section 3.7 of Documentation/kbuild/makefiles.txt, using
EXTRA_CFLAGS in Makefiles is "still supported but their usage is
deprecated." However, using make EXTRA_CFLAGS="-DSOMETHING" results in
EXTRA_CFLAGS from Makefiles being overwritten, obviously breaking the
build.  This patch converts to them to the newer ccflags-y which also
fixes the problem.

Change-Id: I6309439599d4c9cc184f9ecd941bde841982ef07
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:14 -05:00
Allan Stephens a5e40e7247 Split off atomic APIs from main nanokernel include file
The atomic APIs are not really tied to nanokernel-specific
capabilities, and can be used by anyone at anytime -- even
during system initialization!

Change-Id: I427954029b4b465127cb5b4b642c2f9968c17d5a
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:13 -05:00
Allan Stephens 140d314336 Eliminate references to k_memset() and k_memcpy()
Since the kernel now provides a minimal string library, there is
no longer any reason not to use the standard memset() and memcpy()
APIs.

Change-Id: Iad587ace6f41fd94c9c961d13d9322495a7da1be
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:12 -05:00
Dan Kalowsky c02dd34277 Renaming include/nanokernel to include/arch
Renaming the directory include/nanokernel to be include/arch, which
better reflects the real nature of the directory and the contents
inside.

Change-Id: I2bc33ebc6715e2f0403227a558279fdf52398ade
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:14:12 -05:00
Dan Kalowsky 40e7780e65 Renaming CONFIGURE_UART_PORT macro
Renaming the CONFIGRUE_UART_PORT macro to UART_PORT_CONFIGURE.
Done to better align with the current naming process, but also to
remove some possible confusion over the macros source now that
the tree has moved over to Kconfig/Kbuild options.

Change-Id: I1a7691d09818c3d529de346e7fa347ce5ac19aed
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:14:12 -05:00
Dmitriy Korovkin ec8a461bfb Introduce public APIs for random number generation
Convert the existing non-public random number generation APIs
into public APIs (i.e. sys_rand32_init and sys_rand32_get).

Change-Id: Id93e81e351a66d02c08cf3f5d2dd54a3b4b213c5
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:12 -05:00
Dmitriy Korovkin e2fa00be6e Algorithm improvement for timer based random number generator
The timer based pseudo random number generator returns the
number of system clock ticks. If the random number function is
called subsequently in a time less than a system clock tick, it
leads to getting same number.

To prevent this the counter is introduced. Counter gets changed
each call, so it ensures the caller gets different numbers each time
the random number function gets called.

Change-Id: Ibe57e1e7a23909b185623af8dbb7e80647c7ee08
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:12 -05:00
Dmitriy Korovkin 27bcb431cb Random number generator driver unification
Remove ARM specific driver that duplicates the platform
independent one.

Rename x86 specific driver to make it unique.

Added configuration options for random and non-random
number generators.

Change-Id: Ie1b277d2927cdfe877650ae09134db7c86becb76
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:12 -05:00
Dmitriy Korovkin a91736ab9a Convert PCI_DEBUG parameter to a configuration parameter
Change-Id: Ie0272b52bbba56e3381cf33fded873aaa0709af6
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:11 -05:00
Dmitriy Korovkin c3c75902fe Fix UART on Quark platform
UART on Quark platfor, according to Quark BSP Programmer's
Reference Manual, is located in the following order on PCI bus:
COM2 BAR0: 16550 registers
     BAR1: DMA registers
COM1 BAR0: 16550 registers
     BAR1: DMA registers

So, the driver on Quark platform has to specify BAR (Base
Address Registers) number, the pci_bus_scan() function looks for.

As long as UART is a concole device, calling pci_show() during
it's initialization does not make any output.

Change-Id: I2261fbcc8f9e3ebc22d5307fdcbb18cb649c1224
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:11 -05:00
Dmitriy Korovkin 627155afeb PCI scan by BAR number
Added BAR (Base Address Registers) as a parameter for PCI scan.
Some devices (as UART in Quark) use two set of BARs for different
purposes. A driver may require only one of them.

BARs are numbered from 0 to PCI_MAX_BARS.
PCI_BAR_ANY means ignore the BAR number. Constants are defined
in drivers/pci.h

If device class is not specified as a scanning parameter, and
set to 0, ignore it.

Change-Id: I6b7116c5c6cf9c470ab22bec9eb74842f15b5d99
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:11 -05:00
Anas Nashif 3026d8ac1f Kconfig: serial driver menu
Change-Id: Ia5c5db741f811595e914a1f877c3c7fd0007aa94

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:11 -05:00
Anas Nashif b3118c678e Kconfig: add Device Drivers menu
Change-Id: Ie0726f0ac6e04e176e6d13c85056b2c1d50a497e

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:11 -05:00
Anas Nashif 89d50ec95a Kconfig: remove DRV_ configs
Change-Id: Id162a7fe3620f7ad2bc25fbbd55c90b800f9ef70
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:11 -05:00
Anas Nashif 1339edc104 remove defs.objs file
Replaced by kbuild

Change-Id: I61a21ed164b02c7770a181919b35ffafbde4f49e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:10 -05:00
Anas Nashif f4f5cc138c Kbuild: include files dynamically based on BSP_DIR
Change-Id: If36a03acb633c772d599ae1492ebabf04c432306
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:10 -05:00
Juan Manuel Cruz 70611f4c81 Kbuild: Fix duplicated ksymbol UART_INTERRUPT_DRIVEN.
This commit removes the UART_INTERRUPT_DRIVEN kconfig symbol from
the console section.
The symbols is already covered as a serial driver symbol and it
is a serial feature releated configuration option.

Change-Id: I4b9438d79eb7850b1293d5d963a75ce00733dbf7
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:10 -05:00
Juan Manuel Cruz c4535eeddf Kbuild: Kconfig source standard for drivers.
This commit standardize the Kconfig inclusion.
Selective sourcing of Kconfig files create conflict when merging
different configuration files (.config files).
Instead, now each kconfig symbols is dependant of its specific
DRV_* driver ksymbol.

Change-Id: I3d20d108a83f00d34067dc334758fd57e51feecf
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:10 -05:00
Juan Manuel Cruz d15251fec5 Kbuild: Kconfig license headers.
This commit add license headers to Kconfig files.

Change-Id: I79e60263b8c7b696463ecc84b8ad411af5415117
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:10 -05:00
Anas Nashif c4b860cff1 Kbuild: Rename menu for bluetooth uart driver
Change-Id: Ibfc45a91d39fa78406115e209d71d820b028af45
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:09 -05:00
Anas Nashif d2ca03270e Kbuild: Fix sanity checks for quark
Change-Id: Id142f337f715590fa63d9f7b957f51c203743566
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:08 -05:00
Juan Manuel Cruz b7fcfd53e5 Kconfig: Organization of Ksymbols for bluetooth.
This commit organizes the bluetooth Ksymbols in:
 - Driver symbols at drivers/bluetooth/Kconfig
 - Stack symbols at net/bluetooth/Kconfig

Change-Id: I8ebadeb8ac7f8a769d7620e4e44077a05915dc86
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:08 -05:00
Juan Manuel Cruz 638fb2c181 Kbuild: Bluetooth driver support.
This commit adds the Makefile and Kconfig files
to support the bluetooth driver in the Kbuild system.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I1f72b13aca8fb098eece04c4f0e1b680639b520f
2016-02-05 20:14:08 -05:00
Anas Nashif eb4b8eb6ec Kbuild: remove dependency on DRV_RANDOM
Change-Id: I12c0babf7159fc0f3752aec7cc25fa3436428c56

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:08 -05:00
Anas Nashif 50e297dae1 Random driver not used
Conflicts with driver in bsp

Change-Id: Ia2c2794a28d85cfa9795f9b20b3978abdbaccb3d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:08 -05:00
Juan Manuel Cruz 3d2256e522 Kbuild: Change dependencies on DRV_RANDOM.
This commit changes the dependency schemme for DRV_RANDOM.
This fix an issue that prevented the merge of this symbol
as a config overlay.

Change-Id: I734a5814af90b9c57355b78cc43f96f05c1afa96
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:07 -05:00
Juan Manuel Cruz c818cd288c Kbuild: Additional Kconfig symbols.
This commit adds the following Kconfig symbols:
 - INIT_STACKS
 - UART_INTERRUPT_DRIVEN
 - CONSOLE_HANDLER
 - BUILD_TIMESTAMP
 - TICKLESS_KERNEL
 - CONTEXT_CUSTOM_DATA

Change-Id: Id96a7e759c8beac73f27193df07b5c7562379b2f
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:06 -05:00
Juan Manuel Cruz 721b9df9d1 Kbuild: Fix board.h include issue on pentium BSP.
This commit fixes an issue with the inclusion path for the
board.h file for the pentium BSP.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I28172f8071b907aa61660ec8b8009e83cb2aa5ea
2016-02-05 20:14:05 -05:00
Juan Manuel Cruz 4ca3a4a515 Kbuild: Adaptation to the location change of driver headers.
This commit adaptes the Kbuild system to the change of location of
the header files for drivers.
Old location: driver/
New location: include/driver/

Change-Id: Ic49d373149ee44d781419c5c68e59408c8ef1c11
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:05 -05:00
Juan Manuel Cruz 808e5c4ba0 Fixes to Kbuild to build on ARM architecture.
This commit fixes issues to allow build on ARM architecture.
- It fixes the include paths in Makefiles.
- It fixes the include path for the offsets.c compilation.
- It fixes the linker command. This changes is needed because gcc
  ARM cross-compiler does not accept an AT() command without
  specifing an address explicitly. This corner case appears
  on ARM architectures when XIP is disabled.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: Ief8b53c4cc154abba7b7827121ec5a56f62b7b26
2016-02-05 20:14:05 -05:00
Juan Manuel Cruz a05bce491f Kbuild fix for quark console driver.
This commit fixes the include path for quark BSP.

Change-Id: Idb9b5124476c0bec2d16a143407cd9d0c42e0801
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:05 -05:00
Juan Manuel Cruz f2ae6d5202 Creation of Makefiles for drivers directory.
This commit adds the Makefiles that describe the object-bundles
for the drivers directory and every subdirectory below.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: Id77cff9cf0ab51827acc2aef32cbed3ec3ad586b
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz f98466d54b Kconfig symbols for drivers directory.
This commit adds the Kconfig files that describe the CONFIG
symbols that belongs to the drivers directory and subdirectories.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I924835ece11a3d597e77a55ace21d724dd5ddbe5
2016-02-05 20:14:04 -05:00
Tomasz Bursztyka ea4c3d1c0f bluetooth: UART based driver no longer needs to set regs and irq
Now that UART drivers are configured internally when it comes to
hardware specific information such as IRQ and registers (or mmaped
registers), bluetooth UART driver no longer needs to do it by itself. It
only requires to select the port it wants to use.

Change-Id: I5a30500f4b6f4155292609d0ed4a758f91930817
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka 088e0a980f arm: Refactor how UART is configured
UART is configured statically into the driver directly and not anymore
in the board's system.c. Thus limiting the information to be scattered
into 2 files instead of 3. Then in future, it will also be possible to
remove driver specific informations from the generic UART API structure.

Change-Id: I001f2a6834df9a41ab395a80e4e39b347d545db3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka 4eb6aab3ad x86: Refactor how UART is configured
Now for x86 platforms, UART is configured statically or dynamically into
the driver and not anymore in the board's system.c. Thus limiting the
information to be scattered into 2 files instead of 3. Then in future,
it will also be possible to remove driver specific informations from the
generic UART API structure.

Change-Id: I7b7fa37f10f88316a4d375c99de3bbacf152a3e3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka 1cc9c3901e k20uart: Apply a tiny syntax change
Remove camel case style on baseAddr, changing it into base.

Change-Id: Iea1e2d204a38912f4157cc6776a88640e29a04f6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka 724282d27d k20uart: Let's use 'port' everywhere as it is more readable
Using "which" is somehow awkward to use when 'port', on the contrary, is
blatantly more readable.

Change-Id: I355c6e09d7c27b4b07ab6cd10b772a632855516b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka 1eac566143 ns16550: Let's use 'port' everywhere as it is more readable
Using "which" is somehow awkward to use when 'port', on the contrary, is
blatantly more readable.

Change-Id: Id4d3786a192a650ca042024521b94e557a3ec7e8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka d3a4177d92 pci: Provide a simpler yet powerful PCI enumeration API
This fixes many issues around PCI enumeration from old API:
- a static internal table was fed with scanning results, thus eating
  memory, and worse: due to the limit of its size, scanning for new
  classes was impossible unless growing statically the size of this
  table --> more memory eaten! Not to mention PCI enumeration is done
  once at boot time for driver initialization and that's all, so this
  table is hanging around for nothing afterwards.
- one needs first to scan a class, then maybe he will be able to find
  his device via pci_dev_find. Where all could be done at once.
- pci_dev_find was not trustworthy due again to the internal table. Now
  if the device is not found, one will know it really went through all
  the possbilities.
- still let the possibility for hard-coded BARs value on driver side
  (thus no PCI scan required). However this is greatly advised not to do
  so as BARs might change over a firmware/BIOS update.

Comparison:

old pci_dev_scan: could only filter out via class mask.
new pci_dev_scan: can filter out via a class, a vendor and device ID
(it could easily do the same for Function and BAR index as these are
usually fixed and informed through datasheet)

old pci_dev_scan: was limited in its findings by the size of the
internal result table.
new pci_dev_scan: can proceed through all the buses and devices every
time (there are optimizations to avoid useless work of course)

old results did not tell about the function or BAR index.
new one tells, and the structure has not bloated.

old internal code: was storing a big table of results
new internal code: is only storing a small lookup structure and an
array of Bus:Dev pairs for each PCI class for optimizations purpose.
(though, if needed, we could disable this through some #ifdef)

Usage:

- Have a local struct dev_info
- Fill it with what you want to look for, currently: only class and
  vendor_id/device_id. Function and BAR index could be added if needed.
- Call pci_bus_scan_init(): this will reset the internal lookup
  structure.
- Call pci_dev_scan(<a pointer to your dev_info>): at first call, the
  internal lookup structure will pick up the informations from dev_info
  and will try to find out what has been requested. It will return 1 on
  success, or 0. On 1, your dev_info structure will be updated with the
  found informations. If more devices can be found against the same
  lookup informations, just call again pci_dev_scan(<a pointer to your
  dev_info>) as long as it returns 1. When 0 is hit, it will mean you
  found all.

Change-Id: Ibc2a16c4485ee3fed7ef4946af0ece032ae406e4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka 1425fd8449 pci: Apply code style changes
- always add {} on any sub-statements
- proper indentation
- 80 chars limit

Change-Id: I869239bf2e309a6e73fb180cf29acf66c019489a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Yonattan Louise dbada63eee Fix coding style issues.
Some checkpatch issues were solved by scripts leaving other problems
such as alignment and indentation issues.  In order to comply with the
defined coding style the following fixes were made:

- Fixed the function declaration moving the parameters' comments above
  the function in accordance to the doxygen format.
- Fixed functions' opening and closing brackets. These brackets should
  not be indented.
- Fixed the 'if', 'for' and 'while' statements adding the brackets
  around the sentence.
- Fixed comments' alignment.
- Fixed indentation.

The work was done manually and submitted as one commit. I didn't
separate these changes in different commits because they were fixed all
at once. Basically, all errors were fixed in every file at once.

Change-Id: Icc94a10bfd2cff82007ce60df23b2ccd4c30268d
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:59 -05:00
Benjamin Walsh da26208623 timer: use _sys_clock_tick_announce() in drivers
Replace duplicate code and will allow for further cleanup by possibly
consolidating micro/nano code that is currently guarded by preprocessor
conditionals.

Change-Id: I9aa9966c581244646b6ea317ef8b51fef9054dd4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:13:59 -05:00
Benjamin Walsh 0c798772cc timer: fix incorrect nano_fiber_lifo_put in ISR
The correct call is nano_isr_lifo_put, but they are aliases of each
other, so that never caused an issue at runtime.

Change-Id: Ibec8e6d3377133e5e67589c5a3ad1b8fb3cc652c
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:13:59 -05:00
Andrei Emeltchenko 879541a918 console: Refactor serial console interface
Make serial console interface more robust. Enables interrupts only
when registering input, all memory is managed inside application.
Interface to application is changed to have two fifo queues. One
queue is a free line slots and another queue is keeping entered
lines. This way memory for lines is managed inside application which
provides free lines queue. It is also simpler to manage entered
lines by sleeping on fifo_get on app layer.

Change-Id: I4776c03eddd1e7d880df3b902bd48f5f2c901cad
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Johan Hedberg a0bb20f4d1 Bluetooth: coding-style: fix one-line branch braces usage
The coding guidelines make an exception to the Linux kernel style
where all branches, even one-liners, should use braces.

Change-Id: I368930af3033eac15f0152a6671909e401d332e6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:56 -05:00
Yonattan Louise 323e0a133e Rename _I8259SpuriousIntCount to _i8259_spurious_interrupt_count
Updating global variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: Ifadb978e31770eb9f4987a3205483aad9a525b86
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise 0827ff7f80 Rename oldAcc to old_accumulated_count
Updating local variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: Ib426dad55e318bb8176c4e7660711db1484cc245
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise 751022e43b Rename oldCount to old_count
Updating local variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: I6098649b507dae09d4d0f19e712bc0fe3686dfc0
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise 639aa532e4 Rename _i8253IntStub to _i8253_interrupt_stub
Updating global variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: Ie0770bd9ff872a9ed2b567baca1514d15fe6c90a
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise 9935ba54d2 Rename dev_info_idx to dev_info_index
Updating local variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: Iee0936e2c92f2979b7e38f33a950108bdaf6f2c1
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise c43a34b312 Rename _TimerMode to timer_mode
Updating local variable's name to follow a consistent naming convention.
The prefix underscore is removed due to it's a local variable.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: I1f95ae3c2fd44ae3bd366cd33208551cf5ea6d10
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise 04d87ce58f Rename _TimerIdleSkew to timer_idle_skew
Updating local variable's name to follow a consistent naming convention.
The prefix underscore is removed due to it's a local variable.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: I5681dc0c33cc42ee48270eab418c99cc923f96b1
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise 23f1b6f4ca Rename _MaxLoadValue to max_load_value
Updating local variable's name to follow a consistent naming convention.
The prefix underscore is removed due to it's a local variable.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: Id7391e40bb709f03c58f552d6b783cad834bbdcc
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise 5d861d51bb Rename _IdleOrigTicks to idle_original_ticks
Updating local variable's name to follow a consistent naming convention.
The prefix underscore is removed due to it's a local variable.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: I28cbf0d02600d31548393870e712e6da062048da
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise d6b04be694 Rename _MaxSysTicks to max_system_ticks
Updating local variable's name to follow a consistent naming convention.
The prefix underscore is removed due to it's a local variable.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: Ic28658f68d473b3a163fe5d97f611bfd572f140e
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise e111f30cec Rename _IdleOrigCount to idle_original_count
Updating local variable's name to follow a consistent naming convention.
The prefix underscore is removed due to it's a local variable.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: I31e267c1479dfaeeb0fba8c6ba0da45a3c011c0f
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Yonattan Louise 7770ec2db1 Rename accumulatedCount to clock_accumulated_count
Updating local variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" -o -name "*.arch" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: I80ccb884f1ffd8f3740cd9298787462485b08024
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:53 -05:00
Dmitriy Korovkin d33ad051ac Consolidate inline assembler code in a set of header files
In order to have a better compiler support consolidate
inline assembler code in a set of header files.
If another compiler is used, that supports a different
inline assembler format, asm_inline_<compiler name>.h
heder files have to be provided.

Change-Id: Iecc7d96419efd767a8463933badd4db4a557de5b
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:13:52 -05:00
Andrei Emeltchenko ea1f5f3785 Bluetooth: Add Bluetooth UART driver specific debug support
Configuration option BLUETOOTH_DEBUG_UART enables debug support for
Bluetooth UART driver.

Change-Id: I192f380be492df1a52ad212239447b6ee4b50aac
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:50 -05:00
Johan Hedberg caf5141de5 Bluetooth: Remove unnecessary error checks for bt_uart_read() calls
When the 'len' and 'min' parameters passed to bt_uart_read() are equal
the function is guaranteed to always return 'len' (it will keep
looping until that). This patch removes bt_uart_read() error checks
which would never occur in practice.

Change-Id: Icd879f1e15c6d33acc549155aabd24490098ffc5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:50 -05:00
Johan Hedberg 099ecbfa7c Bluetooth: Add minimum required length parameter to bt_uart_read()
There are some places where it's forgivable if bt_uart_read() wasn't
able to read as many bytes as requested. In other places it's not
acceptable (e.g. when reading ACL or event header). To avoid failing
in situations where we can handle receiving less data than requested
this patch adds a new parameter to bt_uart_read() to specify the
minimum required data amount.

Change-Id: I372e3af7aaa6bfabe14896eb10cc71c3deff94f2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:50 -05:00
Johan Hedberg 935198e715 Bluetooth: Fix UART driver robustness when out of buffers
If we're out of buffers the UART driver would previously loose sync of
where the packet boundaries go, because it was using the buffer itself
to store and parse the HCI packet headers. This patch modifies the
UART driver to use stack variable for initial header parsing, thereby
being able to always determine how many remaining bytes there are and
cleanly discard the bytes until the beginning of the next packet.

Change-Id: I278f3fc0c983e6a2a6904356ef1af1d25c9f06e4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:50 -05:00
Johan Hedberg c96f8e484c Bluetooth: Fix potential NULL-pointer access in UART driver
If we get an invalid packet type here the buf pointer will be NULL.
Going to the cleanup section at the end of the function would trigger
a bt_but_put() call which would cause a NULL pointer access. Directly
returning from the function is the right thing to do instead.

Change-Id: I0c18646e0820cf829ef8aa3f77835ba0a14375b5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:50 -05:00
Johan Hedberg d829fe9755 Bluetooth: Consolidate bt_buf_get* functions
We may soon want to have a _wait() variant of bt_buf_get, so to avoid
the number of 'get' function growing too large consolidate the
existing get() and get_reserve() functions into a single one. The new
consolidated function also takes the type as input parameter so that
we know this from the very start and thereby plan for the split into
multiple buffer pools.

Change-Id: Ia09448565349def2be9bc08d9510fedd029480b4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:50 -05:00
Johan Hedberg 4e65d0aac2 Bluetooth: Split ACL buffers into two distinct types
We'll soon want to have dedicated pools for outgoing and incoming ACL
data. To know from which pool to get and put the buffers each buffer
should contain enough information to distinguish the two types. This
patch splits the old BT_ACL type into two new BT_ACL_IN & BT_ACL_OUT
types.

Change-Id: I7d3c05c26d2a70f80fb1229e245aa21673ec378b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:50 -05:00
Tomasz Bursztyka 40b1080150 pci: Put the public API header in the right location
Instead of drivers/pci/, the public API headers will be found in
include/drivers/pci.

Change-Id: I577036660383e6bd9c015d6bbbcbc14bf8fb67ec
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:13:48 -05:00
Tomasz Bursztyka ae09a48a7e console: Put the public API header in the right location
Only moving the header from drivers/console/uart_console.h to
include/drivers/console/uart_console.h so source file did not need to be
changed, only the defs.objs files to look into include/drivers/console.

Change-Id: I585e16b50d9ffecf01ca9225e80f0e101f62ee4c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:13:48 -05:00
Andrei Emeltchenko f1e1897ade console: Replace uartConsoleInit with uart_console_init
Rename camelCase uartConsoleInit function for consistency with the
rest of the code in serial console.

Change-Id: I519737070538e9c0f52a8d110a3eff68e0185ce2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:45 -05:00
Andrei Emeltchenko dfa5f2371b serial_console: Rename console_uart_isr to uart_console_isr
Following comments received during review rename console_uart_isr to
uart_console_isr for consistency reason.

Change-Id: Ibee1dec40ee19a9095f78969a07ffb73518fffbb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:13:45 -05:00
Johan Hedberg 2581ad9313 Bluetooth: Add HCI UART (H4) driver
This patch adds a simple HCI UART (H4) driver that currently maps to
the second UART in the system. The main intention is to use this
together with qemu for accessing the Bluetooth controller available on
the host OS side.

The H4 HCI transport protocol is perhaps the simplest of the standard
HCI transports. It consists of a single byte in the beginning of each
packet which indicates the type of the packet: HCI event, HCI command,
ACL data, or SCO data (which we don't use at the moment).

Change-Id: I225a2a2361fbd7cd4ba82ea1f81ddc1271e9e7c2
Co-authored-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:44 -05:00
Yonattan Louise ab9c05ac2a Rename _SysIdleElapsedTicks to _sys_idle_elapsed_ticks
Updating global variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: I4e5c9419fe0ccbc4b2990b96fc95c697decc18e0
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:44 -05:00
Yonattan Louise 93a1d7ca89 Rename K_Args to _k_command_stack
Updating global variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: I5e249e34ee9666666e31db6b9f71fe2abcc22400
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:43 -05:00
Yonattan Louise c4bd9cc6ab Rename nanoTimerList to _nano_timer_list
Updating global variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: I2e501394b7fa4264d9854659e2dd008e5c94b540
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:43 -05:00
Yonattan Louise cf0b28d243 Rename nanoTicks to _nano_ticks
Updating global variable's name to follow a consistent naming convention.

Change accomplished with the following script:

   #!/bin/bash
   echo "Searching for ${1} to replace with ${2}"
   find ./ \( -name "*.[chs]" -o -name "sysgen.py" -o -name "*.kconf" \) \
            ! -path "./host/src/genIdt/*" \
            ! -path "*/outdir/*" | xargs sed -i 's/\b'${1}'\b/'${2}'/g';

Change-Id: Iebefec0e02cbb838564dd71fd4424c1adbff31f5
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:43 -05:00
Andrei Emeltchenko 0f86fd19f2 uart: Rename INTERRUPT_DRIVEN configuration option
Rename UART_HOSTDRV_INTERRUPT_DRIVEN option to
UART_INTERRUPT_DRIVEN removing old definition.

Change-Id: Id48288db42e97a1ecbd809e259f33359d5a7c9d7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:41 -05:00
Andrei Emeltchenko 139c856403 Add serial console input handler
Serial console handler when registered allows to interact with serial
line. It can either execute callback from ISR or defer execution to
fiber or task. This will be used in Bluetooth development for tests and
simple interaction with Bluetooth stack.

Change-Id: Ia960b456a75062d614baea324608058d979aa11b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:41 -05:00
Dmitriy Korovkin 7a3ee5e95e Rename driver header files according to naming standard
Change-Id: Ib384fd93c3d35abab1754b37d6464ff7dfe4a893
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:13:40 -05:00
Yonattan Louise 5b5f4eb948 Fix checkpatch issue - WARNING:LINE_SPACING
Adding a line after variable declaration in order to comply with
the defined coding style.

Change-Id: Id41af88404bd37227bfd59a2d71ce08d0d6ce005
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:39 -05:00
Inaky Perez-Gonzalez 8ddf82cf70 First commit
Signed-off-by:  <inaky.perez-gonzalez@intel.com>
2015-04-10 16:44:37 -07:00