Commit graph

41120 commits

Author SHA1 Message Date
Charles E. Youse
5dd1bf15fc uart: ns16550: support Apollo Lake PRV_CLOCK_PARAMS (PCP) register
The UARTs on the Apollo Lake SoCs have PLLs that feed the baud rate
generators. This patch allows a user to specify custom M/N values for
those PLLs when custom/high-speed baud rates are required.

I'm not entirely satisfied with the way the PCP values are configured,
because it requires tweaking data in both Kconfig and DeviceTree. For
the time being I've merely taken my cue from another similar feature
(the DLF register support) and have punted on figuring out the "right
way" to expose UART configuration to the application.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-02-28 08:50:34 -08:00
Ioannis Glaropoulos
b5578d8de3 arch: arm: various documentation fixes in arm assembly
This commit fixes several essential inline comments in the
core assembly code for ARM, improving code readability.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 10:10:26 -06:00
Ioannis Glaropoulos
d8d52fab2d arch: arm: mpu: fix constant expression result errors in ARMv8-M impl
This commit applies the same fixes, concering the Constant
Expression Result errors identified in the ARMv7-M and the
NXP MPU drivers, into the ARMv8-M MPU implementation.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 08:47:43 -06:00
Ioannis Glaropoulos
a94d5587fe arch: arm: mpu: fix constant expression result errors
This commit fixes two Constant Expression Result errors,
in the ARMv7-M MPU driver due to incompatible integer types.

Fixes #13844.
Fixes #13854.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 08:47:43 -06:00
Jukka Rissanen
8e066aba0f net: ipv6: Extension header length failure not properly checked
The ipv6_handle_ext_hdr_options() can return negative value
but we stored it into unsigned variable and then checked < 0.

Coverity-CID: 190995
Fixes #13830

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-28 08:47:24 -06:00
Jukka Rissanen
a6614a32c1 net: sntp: Remove useless comparison
The LI bits checks is useless as the bitshifted value cannot be
larger than SNTP_LI_MAX (3).

Coverity-CID: 190924
Fixes #13888

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-28 08:47:10 -06:00
Jukka Rissanen
2db03ce277 samples: net: socket: can: Do cleanup if failure
If bind() fails or TX thread cannot start, then cleanup the
socket by calling close()

Coverity-CID: 191003
Fixes #13824

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-28 08:46:52 -06:00
Jukka Rissanen
4bbcf391c3 net: context: Remove dead code from net_context_connect
The ret=0; statement cannot be reached.

Coverity-CID: 190973
Fixes #13846

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-28 08:46:09 -06:00
Alexander Wachter
18680e55e5 drivers: can: Fix userspace handler parameter types
Change the parameter types from can_msg to zcan_frame and from
can_filter to zcan_filter.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-28 08:45:44 -06:00
Alexander Wachter
b0826442ee drivers: can: Make zcan_frame const for sending
For sending the zcan_frame can be const, because its only
copied to the registers.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-28 08:45:44 -06:00
Alexander Wachter
8aab2e7bb9 include: can: Fix positive and overlapping error numbers
The error numbers are currently not negative an CAN_TIMEOUT overlapps
with TX errors. Fix that by making the numbers negative and timeout
the first negative number.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-28 08:45:44 -06:00
Paul Sokolovsky
d01f75be7e lib: os: fdtable: Add underscore aliases for read/write/close/lseek
These get references by newlib builds in other toolchains, e.g.
gnuarmemb, and lack of them breaks linking. Tested that
tests/posix/fs and tests/posix/common actually work with these
changes.

Fixes: #13906

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-28 08:45:13 -06:00
David B. Kinder
e731bdc81a doc: fix docs, include, and Kconfig misspellings
Fix misspellings missed during regular reviews

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-02-28 09:32:12 +01:00
Andy Ross
9c2c115716 kernel/spinlock: Predicate spinlock validation on flash size
The spinlock validation isn't super lightweight -- it adds only a few
tens of bytess per call, but there are a LOT of locking calls.  On
smaller platforms with 32kb of flash, we're bumping into code size
limits on the bigger tests (tests/kernel/poll is a particular
offender).

Check the declared flash size before enabling it.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-27 14:22:06 -08:00
Andy Ross
a4614372f9 tests: Mass SMP disablement on non-SMP-safe tests
(Chunk 3 of 3 - this patch was split across pull requests to address
CI build time limitations)

Zephyr has always been a uniprocessor system, and its kernel tests are
rife with assumptions and outright dependence on single-CPU operation
(for example: "low priority threads will never run until this high
priority thread blocks" -- not true if there's another processor to
run it!)

About 1/3 of our tests fail right now on x86_64 when dual processor
operation is made default.  Most of those can probably be recovered on
a case-by-case basis with simple changes (and a few of them might
represent real bugs in SMP!), but for now let's make sure the full
test suite passes by turning the second CPU off.  There's still plenty
of SMP coverage in the remaining cases.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-27 14:22:06 -08:00
Savinay Dharmappa
ade05335b3 tests: counter: Adapt test for the qmsi rtc driver
The qmsi rtc hardware supports a single alarm only and a fixed top
value, so restructure the counter_basic_api test to skip unsupported
features.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-02-27 12:33:53 -08:00
Savinay Dharmappa
5307953091 drivers: counter: Modify set top value api.
patch modifies the set top value api to return error only
when ticks passed from application is not equal top value
supported by hardware.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2019-02-27 12:33:53 -08:00
Andy Ross
dff6b71450 kernel/sched: More nonatomic swap fixes
Nonatomic swap strikes again.  These issues are all longstanding, but
were unmasked by the dlist work in commit d40b8ce1fb ("sys: dlist:
Add sys_dnode_is_linked") where list node pointers become nulls on
removal.

The previous fix was for a specific case where a timeslicing interrupt
would try to slice out the "wrong" current thread because the thread
has "just" pended itself.  That was incomplete, because the parallel
code in k_sleep() didn't flag itself the same way.

And beyond that, it turns out to be basically impossible (now that I'm
thinking about it correctly) to prevent interrupt code from calling
into the scheduler to suspend a "just pended but not quite" current
and/or preempt away to another thread.  In any of these cases, the
scheduler modifications to the state bits remain correct but the queue
nodes may be corrupt because the thread was already removed from the
ready queue.  So we have to test and correct this at the lowest level,
where a thread is being removed from a priq: check that it's (1) the
ready queue and not a waitq, (2) the current thread, and (3) already
marked suspended and thus not in the queue.

There are lots of existing issues filed in the last few months all
pointing to odd instability on ARM platforms.  I'm reasonably certain
this is the root cause for most or all of them.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-27 12:07:34 -08:00
Ulf Magnusson
775993a61a arch: arc: Replace CONFIG_APP_SHARED_MEM with CONFIG_USERSPACE
CONFIG_APP_SHARED_MEM was removed in commit 4ce652e4b2 ("userspace:
remove APP_SHARED_MEM Kconfig").

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 13:37:53 -06:00
Daniel Glöckner
c9e7a5b6b0 debug: openocd: change how we manage differences between versions
Every time the array of offsets was changed, it was changed in a
backward compatible way by appending elements to the end. The version
number was incremented to inform OpenOCD about the existence of the new
elements. But the patch for OpenOCD to support Zephyr has never been
updated to support anything else than version 0, causing OpenOCD to
reject recent Zephyr versions. So the idea of using a version number to
track compatible changes didn't work out.

Therefore add another symbol that can be read by OpenOCD to get the
number of elements in the array. This value is automatically calculated
during compilation. The version number element should from now on be
incremented only for incompatible changes.

Fixes: #13448

Signed-off-by: Daniel Glöckner <dg@emlix.com>
2019-02-27 13:25:28 -06:00
Ioannis Glaropoulos
8354f4c274 arch: arm: nxp mpu: align MPU disable function with that of ARM MPU
This commit aligns the implementation of arm_core_mpu_disable()
function in NXP MPU with the implementation in the ARM MPU
module, by introducing a Data Memory Barrier, (DMB) instead of
a DSB instruction. This is in accordance with the ARM guidelines
of using the memory protection unit.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-27 13:24:49 -06:00
Michael Scott
d318da1db9 samples: basic: fix nRF52 PWM name in blink_led/fade_led samples
commit ddf744deee ("drivers: pwm_nrfx: Use Device Tree label as
instance name") removed the config setting for PWM names and replaced
it with DT_NORDIC_NRF_PWM_PWM_*_LABEL.

This change is causing the blink_led and fade_led samples to break
when compiled for nRF52 boards.

Let's update the samples to use the DT setting.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-02-27 12:22:42 -06:00
Kumar Gala
34a2630141 drivers: gpio: sx1509b: convert to DT_<COMPAT>_<INSTANCE> defines
Convert sx1509b sensor driver to use new defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-27 10:19:30 -06:00
Armando Visconti
16dc36bb61 samples/96b_argonkey: microphone: Fix coverity bug 190958
Fix coverity CID 190958: Logically dead code (DEADCODE)
(bug: #13857)

Condition (ret < 0) was tested, but 'ret' variable was not
assigned.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-02-27 10:02:49 -06:00
Ulf Magnusson
d3bf4b432c scripts/dts: Remove dead 'aliases' check in insert_defs()
insert_defs() is the only function that adds keys to 'defs', and they
always get added with an 'aliases' key.

This function could get super simple if the duplicate-removal code could
be removed. It only seems to be needed to prevent duplicates for some
(unfortunately tricky) flash-related stuff now.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
25ff4b72a9 scripts/dts: Remove global 'structs' variable
Unused.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
59a0c4331d scripts/dts: Fix binding_compats/bindings_compat naming mismatch
'binding_compats' makes the most sense, so use that everywhere.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
5999f10ba2 scripts/dts: Get rid of deepcopy() and 'except:' in translate_addr()
- No deep copying is needed. The deepcopy() is just a hack to work
   around that the value might not be a list. That deserves a comment at
   least.

 - A catch-all try/except will hide stuff like misspelled variables as
   well. It's usually a bad idea.

Rewrite things to be more explicit, and add some comments.

reg.py was indirectly using the deepcopy() imported in global.py,
because it does 'from global import *'. Have it import deepcopy() itself
instead. reg.py is the only remaining user of deepcopy().

reg.py relying on the deepcopy() import in global.py was super hard to
discover, due to another catch-all try/except around the deepcopy()
call.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
9d4c2921ee scripts/dts: Remove redundant 'children' check in create_chosen()
All nodes have a 'children' key.

Also simplify a bit. The loop is copying a dictionary verbatim.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
5edeec3dc4 scripts/dts: Simplify and document get_compat()
Get rid of the try/except and the find_parent_prop() call. Also add some
documentation.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
e0f55f17e8 scripts/dts: Fix get_parent_path() for top-level nodes
'/foo' was turned into ''. Turn it into '/' instead. That's how the root
is represented in 'reduced' too.

Also remove some code from get_addr_size_cells() that was only there to
work around the bug.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
bc73ba6fc3 scripts/dts: Remove get_node_compats()
Unused.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
392587b2a5 scripts/dts: Remove redundant 'children' check in create_aliases()
All nodes have a 'children' key.

Also simplify and improve naming a bit.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
3513c260c0 dts/bindings: Remove 'generate: define' from 'interrupt-names' bindings
After commit 'scripts/dts: Never ignore properties in
generate_node_defines()', pointless entries for 'interrupt-names'
properties show up in generated_dts_board.conf and
generated_dts_board_fixups.h, because many bindings specify
'generate: define' for 'interrupt-names'.

If 'generation: define' is taken as "generate #define's for this
particular property", then only the 'interrupts' property ought to have
'generation: define'. Having it on both 'interrupts' and
'interrupt-names' makes you wonder what it would mean to only have it on
one of them.

Things get a bit confusing since 'interrupt-names' is still used when
determining the macro names generated for 'interrupts', but it's
probably best to have 'generation: define' work in a consistent way
still (and never be a no-op).

Remove 'generation: define' from all 'interrupt-names' bindings.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Ulf Magnusson
246a15c4db scripts/dts: Never ignore properties in generate_node_defines()
If a binding specifies 'generate: define' for 'interrupt-names' (like
some bindings do), then that ought to generate #defines for it, but the
scripts/dts code currently hardcodes 'interrupt-names' to be ignored
(along with some other properties).

Maybe the 'generate: define' in those bindings is a mistake, but the
code still ought to respect it. That also gets rid of some mystery code.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 10:02:35 -06:00
Erwan Gouriou
e199ff542c drivers/clock_control: stm32: Use RCC_PLLCFGR_PLLQ_Pos directly
For PLLQ divisor configuration, use directly RCC_PLLCFGR_PLLQ_Pos
definition instead of calculating its position from RCC_PLLCFGR_PLLQ.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-27 08:54:55 -06:00
Erwan Gouriou
601dcac286 drivers/clock_control: stm32: Fix default value for AHB prescaler
Default AHB presacler value was set to 0 which is not an allowed
value. Set it to 1 and limit range from 1 to 512.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-27 08:54:55 -06:00
Johann Fischer
7b7e8e89b7 drivers: ssd1306: fix build for SH1106 controller
Fix build for compatible SH1106 controller.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-02-27 08:54:20 -06:00
Sebastian Bøe
ea57a9fb7d cmake: Omit comments that are either redunant or wrong
Drop these CMake comments. It is redundant with a below comment to
describe 'app', and it is incorrect to state that omitting
boilerplate.cmake is permitted/supported.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-27 08:50:59 -06:00
Sebastian Bøe
1108e38a01 cmake: Omit if statement that is always true
We had an if-statement around policy 79 because we used to need to
support CMake versions before 3.13.0. But now 3.13.1 is the minimum
required version so the if statement always evaluates to true and can
be omitted.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-27 08:50:59 -06:00
Andrei Emeltchenko
4035cb62dd usb: dfu: Fix missing break in case statement
Fixes #13870

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-27 08:49:13 -06:00
Michael Scott
cc1b6b024b net: lwm2m: fix json formatter putchar check
Found via Coverity CID 191001: Control flow issues  (NO_EFFECT)
This less-than-zero comparison of an unsigned value is never true:
"put_char(out, '}') < 0U".

Let's fix this check to be less than 1 instead as it should have
been originally.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-02-27 08:36:12 -06:00
Jukka Rissanen
4021bb3cf2 doc: net: Minor tweaks to gptp documentation
Adding OpenAVnu/gptp and linuxptp links to the doc.
Also the "Application interfaces" chapter had some style issues.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-27 08:35:50 -06:00
Jukka Rissanen
c74d3b06d5 net: doc: Add missing doxygen comments to structs
The doxygen comment for ieee802154_radio_api, net_l2 and
net_pkt structs was missing, which meant that no documentation
was generated for them.

Also add comment to "enum net_l2_flags" as that looks better in
the generated html file.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-27 08:34:39 -06:00
Paul Sokolovsky
9744985af1 net: context: Fix send function documentation
Newly added net_context_send_new()/net_context_sendto_new() take
void *buf, size_t len params but in docstring, refer to "network
buffer", which is apperently copy-paste artifact.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-27 08:33:52 -06:00
Paul Sokolovsky
fff2011fb5 samples: sockets: echo_server: Print port number to connect to
We have a great number of samples now, using different port numbers,
etc. Let them be self-documenting and print out port number used.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-27 08:32:58 -06:00
Stanislav Poboril
ee1bdc12f7 ext: hal: nxp: imx: Fixed duplicit file device_imx.h
The file was in two subfolders as copied from the FreeRTOS BSP
for i.MX6 and i.MX7. Unified the file and moved it into the
devices folder, like in the FreeRTOS BSPs.

Fixes: #13748

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2019-02-27 08:32:31 -06:00
Krzysztof Chruscinski
e64cd5c74d logging: Fix silent logs dropping when LOG_MODE_OVERFLOW disabled
There was no notification about dropped logs When logger operated
in the mode where message is dropped when logger has no space to
store the message. Notification was printed only if logger operated
in the mode which overwrites oldest log.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-27 08:32:14 -06:00
Piotr Zięcik
ddf744deee drivers: pwm_nrfx: Use Device Tree label as instance name
This commit replaces Kconfig options defining PWM instance
names by device tree labels.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-27 12:50:59 +01:00
Pawel Dunaj
aab77ea10f bluetooth: Fix broken directed advertising
This code probably got broken during some merge.

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2019-02-27 11:49:48 +02:00