Commit graph

55890 commits

Author SHA1 Message Date
Andy Ross
d75bc8c310 soc/intel_adsp: Fix MP startup for cAVS 2.5
This hardware works a little differently.  The cores will start up
immediately on receipt of an IDC interrupt (they don't need the host
to be involved), but they don't have a ROM.  They start executing at
the start of the LP-SRAM block always.  Copy over a tiny trampoline
for them that jumps to the existing multiprocessor startup path.

Also set the PS WOE bit to enable register windows in the startup
path.  This isn't the hardware default, and where the ROM would do
that for us before here we need to make sure it's on.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-03 07:19:34 -04:00
Andy Ross
a29b66bbf5 Revert "soc: intel_adsp: fix linker script for XCC"
This reverts commit ee7773fb46.

Unfortunately this mechanism doesn't seem to actually work on the SDK
linker.  The emitted sections, when passed a symbol name as the "start
address" just appear wherever the "." variable was pointing (in this
case, into the cached region).  That breaks the kernel coherence
layer, obviously.

Revert for now, which will regress the XCC build fix pending a proper
root cause.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-03 07:19:34 -04:00
Daniel Leung
8a21dc8245 xtensa: intel_adsp: align SoC initialization with SOF
This aligns the SoC initialization with the one in SOF,
especially the manipulation of clock control and power control
registers. These registers are not entirely the same across
CAVS versions, so we need to deal with them according to
which version we are building for. This also consolidates
the macros for these registers to the one provided by SOF
(soc/shim.h) to avoid duplication. Another note is that
the usage of clock gating bit was not correct. In SOF,
clock gating of SoC cores should be allowed but the old code
in Zephyr prevented clock gating, which has the potential to
prevent the whole DSP from going into low power mode.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-09-03 07:19:34 -04:00
Andy Ross
a0a9a67e58 soc/intel_adsp: Fix timing/clock register ownership on cAVS 1.8+
The wall clock timer is not (per documentation) part of the
"timestamping" register set on the DSP.  And its counter and
comparator registers work fine always.  But if the DSP isn't set as
the "owner" of the timestamp hardware, wall clock interrupts never
arrive.

Also grab the PLL ownership too, because SOF already does anyway.
While we don't have a dynamic clock driver yet, we will surely want
one soon and will needt this.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-03 07:19:34 -04:00
Andy Ross
87579a9daa soc/intel_adsp: Increase init priority of trace windows
These windows control host visibility of the trace output buffer.  The
buffer itself is writable memory always, but until we get to the
register init the host can't see them.  Since they contain
printk/logging output, they REALLY need to be initialized earlier than
anything else.

Also remove a rogue memset of the trace buffer.  That buffer is
already being initialized in a lazy-evaluated way by the trace output
code, and blowing it away here has the effect of forgetting anything
earlier code was trying to log!

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-03 07:19:34 -04:00
Andy Ross
cc2e1bebbe boards/intel_adsp_cavs25: Add board documentation
The default development environment for this target is in fact a
consumer Chromebook available to anyone.  So it deserves public
documentation.

Note that this spends considerably more time explaining the details of
how to configure a chromebook as a Zephyr development platform than it
does the process for building and running Zephyr (which is really very
conventional).  Chromebooks, which allow user-signed audio firmware,
are a great boon to SOF development.  But they were never intended as
developer devices themselves.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-03 07:19:34 -04:00
Andy Ross
7d8da0f3dd soc: intel_adsp: Lengthen initialization sleep on the cavs 1.5 loader
This was still observed to be failing occasionally.  Seems like 100ms
is more robust than 10ms.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-03 07:19:34 -04:00
Andy Ross
12560d54c7 soc/intel_adsp: Update cavs-fw.py loader for cAVS 2.5 devices
Add a loader script variant for Tiger Lake (cAVS 2.5) devices, which
have very slightly different loading behavior from older 1.5 DSPs.

This is added as a "-v25.py" script, and the original has been renamed
to cavs-fw-v15.py.  Note that there is no good reason except schedule
pressure that these are not the same script, I just wasn't able to
make a single script work compatibly in the time available.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-03 07:19:34 -04:00
Andy Ross
eca7cc7a4a boards/intel_adsp: Update cavs-fw.py, robustify vs. Linux PM
Add support for the extended manifest blocks that recent versions of
rimage are including as a prefix on the firmware blob.

Also include some PCI runtime PM tricks to reliably enable the DSP
device on kernels that have turned off the DSP device automatically
(e.g. systems that have PM enabled by default but where the SOF driver
is not loaded -- chromebooks work this way, potentially other
distros).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-03 07:19:34 -04:00
Lingao Meng
790ec89048 Bluetooth: Mesh: Fix missing destructor function
Zephyr Bluetooth Mesh move adv send cb to buf destructor
callback, There are two net_buf_pool define, one to adv.c
and ore to friend.c, we are missing destructor in friend.c.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-03 06:32:08 -04:00
Emil Gydesen
0ffb084bfb Bluetooth: iso: Fixes ISO paramter checking issues
Two checks reported wrong value if the value was invalid.
CIS parameter check would always fail on correct values
due to missing negation of valid_chan_qos.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-03 06:31:45 -04:00
Nikolai Kondrashov
77ee1f02aa doc: Fix a few typos in docs/comments/messages
Fix two typos in documentation, one in a sample's comment, and one in a
sample's console message. Found while learning Zephyr and exploring the
sources.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
2021-09-03 06:06:59 -04:00
Mikkel Jakobsen
e12e126f32 boards: arm: Add mcuboot flash partitions to mimxrt1024_evk
Adds flash partitions and chosen nodes to the mimxrt1024_evk device tree
to support mcuboot on the internal QSPI flash.

Also adds missing zephyr,itcm chosen node.

Also enables FlexSPI flash driver XIP mode support on this board to
support mcuboot.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
2021-09-02 22:40:15 -04:00
Mikkel Jakobsen
ef8434d9eb dts: arm: nxp: fix mimxrt1024 flash configuration
add correct binding, fix size to 32MBit, add erase and write
block size to support mcuboot and rename to reflect the actual
flash model.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
2021-09-02 22:40:15 -04:00
Mikkel Jakobsen
f8281e728b modules: nxp_imx: Add HAS_MCUX_FLEXSPI to mimxrt1024
the config symbol was missing for some reason even though
the soc does have a flexspi peripheral like most other socs
in the family.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
2021-09-02 22:40:15 -04:00
Jeremy Bettis
1fee4849bc cmake: Populate var CMAKE_GCOV
For each compiler, also set a CMAKE_GCOV var referencing the appropriate
gcov tool.

Tested with gcc and host-gcc on the ChromeOS codebase.

Signed-off-by: Jeremy Bettis <jbettis@chromium.org>
2021-09-02 19:44:00 -04:00
Kamil Kasperczyk
e9f238889b shell: uart: Add waiting on DTR signal before sending data
Problem:
In some cases, as described in: https://github.com/zephyrproject-rtos/zephyr/issues/36948
shell backend sends characters to output before serial device
is ready for it. It results in observing additional characters
inserted on the shell input after device boot.

Solution:
Added waiting on DTR signal before sending anything to the output.

Fixes: #36948

Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
2021-09-02 19:39:16 -04:00
Michał Narajowski
f51cf9ab86 Bluetooth: mesh: Fail provisioning when RFU values are used
When Public Key field is set to RFU value then we should send
Provisioning Fail with Invalid Format error.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-09-02 19:38:52 -04:00
Krzysztof Chruscinski
8ca8280cc3 tests: lib: ringbuffer: Fix preempt_cnt not being reset
Counter was not reset between various tests which may hide the fact
that number of preemptions is less than expected.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-02 19:38:37 -04:00
Krzysztof Chruscinski
ad6fc38b2f tests: lib: ringbuffer: Fixing tests for various platforms
Stress test that was validating thread safeness was configured to use
higher sys tick rate and targeting qemu_x86 platform. However, it was
also build for other platforms and was failing. Fixing it by extracting
stress tests to separate configuration that is run only on qemu_x86.

Modified the test to fail when number of preemptions is less than
expected only on qemu_x86.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-02 19:38:37 -04:00
Vinayak Kariappa Chettimada
b51021af3c Bluetooth: Host: Fix MPU fault due to incorrect EV_COUNT
Fix MPU fault due to incorrect EV_COUNT, `conn_change`
signal was not accounted for in the array used by k_poll.

Relates to commit 7854088116 ("Bluetooth: ISO: Fixes
missing handling of broadcast ISO TX").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-02 19:38:16 -04:00
Neil Armstrong
95315239d8 pcie: use newly introduced IDs define for MSI/MSI-X
Remove the locally MSI/MSI-X capabilities ID define and use the
newly introduced one from the PCI Code and ID Assignment
Specification Revision 1.11 document header.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-02 19:37:56 -04:00
Neil Armstrong
bcbae563ea pcie: add PCI & PCIe capabilities IDs defines
Add defines for all the PCI and PCIe capabilities from the PCI Code
and ID Assignment Specification Revision 1.11 document.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-02 19:37:56 -04:00
Neil Armstrong
99c2279abf pci: add Extended PCI(e) capability offset get
Extend the PCIe API to find Extended Capabilities in the PCI Express
Extended Capabilities located in Configuration Space at offsets 256
or greater.

Note: the Root Complex Register Block is not supported

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-02 19:37:56 -04:00
Emil Gydesen
bebfdaf88b Bluetooth: samples: Improve disconnect handling iso_connected_benchmark
Improve the disconnect handling in the sample.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-02 19:37:28 -04:00
Emil Gydesen
84ac32e32d Bluetooth: samples: Improve disconnect handling in central_iso
Improve the disconnect handling in the sample, and
avoid creating a new cig for each connection.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-02 19:37:28 -04:00
Emil Gydesen
12a26649f5 Bluetooth: ISO: Wait for ISO disconnect event
Instead of disconnecting ISO channels on ACL,
we put them in a non-connected state, and wait for
the ISO disconnect events.

This ensure that the controller has free'd the
ISO channels when the iso disconnect callbacks
are received. It will thus be possible to e.g.
terminate the CIG on the ISO disconnect callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-02 19:37:28 -04:00
Emil Gydesen
5d14cddaa8 Bluetooth: ISO: Fixes ISO central disconnect and cleanup issues
When an ISO channel is disconnect on the central, it is
not deallocated, but merely disconnected. This is because,
as per the HCI spec, the CIS handle lives on in the CIG.

Instead of unref'ing the bt_conn to 0, we simply put the
channel and connection in the disconnected state.

This also fixes a few missing returns for
terminating a CIG.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-02 19:37:28 -04:00
Emil Gydesen
891d838140 Bluetooth: samples: Fix iso_connected_benchmark disconnect
The disconnect handling of ACL connects in the sample was done
incorrect, and caused a call to bt_conn_unref with a NULL
pointer.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-02 19:37:28 -04:00
Nicolas Pitre
5a384b9ea8 lib/os/cbprintf_nano.c: avoid sign extension on unsigned formats
There might be a sign extension when a long is promoted to
int_value_type and the former type is smaller than the later.
This produces the wrong output if the specified format is unsigned.

Let's avoid this problem by handling signed and unsigned cases
explicitly. When the type already matches int_value_type then the
compiler is smart enough to recognize the redundancy and removes
unneeded duplications automatically, meaning that the code will stay
small when code size matters.

A similar issue also existed in the restricted %llu case.
The fix is the same as above.

Those fixes exposed wrong results in the printk.c test with %llx
so fix that as well.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-09-02 19:37:06 -04:00
Marcin Niestroj
02fa7be52d net: mqtt: check mqtt_abort() function parameters before locking
Function parameters can be checked without MQTT instance lock being
held. Additionally if NULL parameter would be passed (which this check
tries to handle), then function would return without releasing lock.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-09-02 19:36:03 -04:00
Pavlo Hamov
6975d92324 net: socket: fix significant buffer tls send
Sending of > 2k buffers leads to split socket writes.
Current implementation is not checking for full buffer size.
ztls_sendmsg_ctx proceeds to next iov on sucessful write.

Solution: Add loop into ztls_sendmsg_ctx to process whole buffer
before proceeding to next iov.

Signed-off-by: Pavlo Hamov <pasha.gamov@gmail.com>
2021-09-02 19:35:50 -04:00
Lingao Meng
34a1d676c9 samples: bluetooth: Fix scan filter
We should use no filter filter to process adv data
according to code comment above.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-02 19:35:26 -04:00
Kai Vehmanen
3cc14b2c2b soc: intel_adsp: fix linker script for cavs_v20
Apply a similar fix for cavs_v20 as was done for other cavs platforms in
commit ee7773fb46 ("soc: intel_adsp: fix linker script for XCC").
Without this fix, cavs_v20 build with fail with 0.13.0 Zephyr SDK.

Fixes: 74cc8bee7c ("xtensa: cavs_v20: use uncached addresses to support SMP")
BugLink: https://github.com/thesofproject/sof/issues/4703
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-09-02 19:34:12 -04:00
Hake Huang
6232ade277 tests: add spi dma loop test on frdm_k64f
add spi edma loop mode test

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-09-02 15:50:52 -05:00
Hake Huang
ef410ee732 drivers: spi: Update mcux driver to support edma
enable spi driver to support dspi edma

add support for shared dma mux spi port

for shared spi port we need judge the irq source

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-09-02 15:50:52 -05:00
Hake Huang
cc1801440f spi: mcux: update driver init priority
use the CONFIG_SPI_INIT_PRIORITY to init device driver

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-09-02 15:50:52 -05:00
Hake Huang
c5512287a0 dts: add spi edma support for frdm_k64f
add frdm_k64f spi edma support in dts

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-09-02 15:50:52 -05:00
Hake Huang
de56fdb3d8 dts: update nxp kinetis dspi to support edma
add necessary features for edma into dts for kinetis DSPI

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-09-02 15:50:52 -05:00
Christopher Friedt
650b111ba5 drivers: flash: Kconfig.sam: -depends on and +dfu sample exclude
The additional depends on SOC_FAMILY_SAM was redundant.

Add sam4l_ek to dfu sample exclude since it was failing on
arduino_due.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-09-02 13:23:47 -04:00
Stephanos Ioannidis
2208844f17 lib: newlib: Add workaround for #38258
For the Xtensa platforms (e.g. qemu_xtensa), the first `malloc` call
may fail if the newlib heap base address is such that the first `sbrk`
call returns a 4096-byte aligned address.

Here we add a workaround for Xtensa that allocates and immediately
frees a 16-byte memory block during initialisation so that all
subsequent `malloc` calls succeed.

This commit needs to be reverted once the issue #38258 is fixed.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-09-02 10:58:15 -05:00
Gerson Fernando Budke
529d9149d3 mgmt: updatehub: Use coap_packet_get_payload function
The #36758 fixes coap_packet_get_payload function by normalizing
offset value in the library.  That change create a regression on
UpdateHub.  However, the UpdateHub can now use coap_packet_get_payload
function instead manually compute payload start and payload size.
This refactors the current code in favor of coap_packet_get_payload
and fixes the regression.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2021-09-02 16:54:15 +02:00
Erwan Gouriou
4ec03e0f2b west.yml: hal_stm32: Fix unused var in stm32f4 hal
Update west manifest to enjoy the fix.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-02 07:27:52 -05:00
Bradley Bolen
bdc80ebe16 samples: tracing: Add a sample for tracing_user
The user tracing backend allows one to implement weak symbols to perform
user specific tracing, e.g gpio toggling or spi transactions.  This adds
a qemu sample that just does a simple printk for each of the traced
functions, but could be changed to do whatever function the user
desires.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-09-02 06:54:35 -04:00
Nicholas Lowell
cc8ab95760 tracing: Add user-definable tracing interface
Create a new tracing option TRACING_USER that allows
the user to define certain user_sys_trace_... functions
to perform whatever work desired for tracing when
tasks are swiched in/out, during isr enter/exit, and when
cpu is idle.

This infrastructure can be useful for plugging into
locally defined tracing tools or any user-specific
debugging environment.

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2021-09-02 06:54:35 -04:00
Grixa Yrev
27ac1cb012 drivers: can: mcux_flexcan: fix irq connect
IRQ_CONNECT macro last argument is architecture-specific flag,
but now there is instance id at this place.

This PR set architecture-specific flag to 0.

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
2021-09-02 06:46:10 -04:00
Gerson Fernando Budke
28ba3b5e50 tests: drivers: adc: Add sam0 boards configs
Add sam0 boards configuration to test api.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-02 06:45:35 -04:00
Gerson Fernando Budke
3d85dd8cdc samples: drivers: adc: Add sam0 boards overlays
Add sam0 boards overlays to demostrate how to configure io-channels.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-02 06:45:35 -04:00
Gerson Fernando Budke
bca28015e3 drivers: adc: adc_sam0: Fix result ready interrupt
Atmel sam0 adc peripheral have multiple interrupt vectors for same5x
devices.  This configure interrupt vector by name to ensure that proper
interrupt handle will be executed.

Fixes #37779

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-02 06:45:35 -04:00
Gerard Marull-Paretas
f667b09ade drivers: display: ssd1306: add missing error handling
gpio_pin_configure_dt call was not being checker for errors.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-02 06:42:31 -04:00