Commit graph

974 commits

Author SHA1 Message Date
Kai Vehmanen
ffd2121c65 soc: xtensa: intel_adsp: cavs: fix power_down_cavs() signature
The second argument 'uint32_t *hpsram_pg_mask' must be a cached
pointer and this needs to be reflected in function prototype.

Fixes sparse warning:
/zep_workspace/zephyr/soc/xtensa/intel_adsp/cavs/power.c:106:63:
warning: incorrect type in argument 2 (different address spaces)

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-08-30 10:22:45 +02:00
Kai Vehmanen
a1d7ffdc37 soc: xtensa: intel_adsp: cavs: fix incorrect cached/uncached cast
Converting between cached and uncached aliases should have correct
sparse annotations. Fix following sparse warning:

/zep_workspace/zephyr/soc/xtensa/intel_adsp/cavs/power.c:97:53: warning:
incorrect type in argument 1 (different address spaces)

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-08-30 10:22:45 +02:00
Kai Vehmanen
ce7c30c129 soc: intel_adsp/ace: use WAIT_FOR for core power transitions
Use WAIT_FOR to wait for core power changes to be reflected
in status registers. If core power state does not complete in
10ms, k_panic() is raised.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-08-29 16:14:18 +02:00
Kai Vehmanen
c6284d4afe soc: adsp: clk: use WAIT_FOR() to wait on clk power-up
Use WAIT_FOR to wait for clock source to be enabled. If clock does
not come up in 10ms, raise k_panic().

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-08-29 06:54:02 -04:00
Daniel Leung
169f505226 xtensa: add support for dc233c SoC for QEMU
This adds SoC and board configs to support the dc233c core
that is available on QEMU. This core has more features than
sample_controller, such as MMU support.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-26 16:50:40 -04:00
Florian La Roche
5727503489 style: move ALWAYS_INLINE to the beginning to resolve compiler warnings
With gcc from the zephyr sdk and -Wold-style-declaration is giving this
output:
zephyr/arch/arm/core/aarch32/cortex_a_r/fault.c:101:1: warning:
  'inline' is not at beginning of declaration [-Wold-style-declaration]
  101 | static void ALWAYS_INLINE
                    z_arm_fpu_caller_save(struct __fpu_sf *fpu)
      | ^~~~~~

I searched to all of the source code to find these further occurances
where inline is not at the beginning of a function declaration.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2023-08-23 14:44:23 +02:00
Eric Holmberg
526ff047cc soc: xtensa: espressif_esp32: add SPIRAM heap offset and size
The existing heap starts at the beginning of SPIRAM which is also occupied
by the WiFi stack if CONFIG_ESP32_WIFI_NET_ALLOC_SPIRAM is enabled.  This
results in memory corruption.

Update the linker description to add a _spiram_heap_start symbol and add a
KConfig size option to allow the SPIRAM stack to be correctly located and
sized.  Requires matching commit in hal_espressif.

Fixes: 61359

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-22 14:44:16 +02:00
Daniel Leung
3c3f480be8 esp32: rename shadow variables
Rename shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Daniel Leung
307708c450 xtensa: sample_controller: smaller intermediate build artifacts
For some weird reasons, if the sections in linker script are not
in memory address order, there are lots of padding involved in
zephyr_pre0.elf. This moves the .intList section to its memory
ordered location. When building hello_world, this shrinks
zephyr_pre0.elf from 512MB to 339KB.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 10:00:46 +02:00
Sylvio Alves
bcb59b8f46 soc: esp32s3: fix heap_sentry reference
Fix heap_sentry value to point final useful stack area.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-08-16 15:03:57 +02:00
Gerard Marull-Paretas
3118a8c05c soc: riscv|xtensa: esp32: add support for sys_poweroff
Implement the sys_poweroff hook for all ESP32 SoCs based on the previous
SOFT_OFF implementation.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-15 10:15:38 -07:00
Ievgen Ganakov
be779f2a61 intel_adsp: hda: fix usage of FIFORDY bit
In case of HDA Link DMA FIFORDY bit is RO according
to HW specification thus should be managed by HDA controller.

Add a logic to set FIFORDY for HDA Host DMA only

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2023-08-11 06:25:48 -04:00
Tom Burdick
6e66efa088 soc: intel_adsp_ace15: Include stdint.h
File was using stdint.h defined types without including and caused a
build error depending on include ordering.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-08-04 10:41:27 +02:00
Flavio Ceolin
250748bfe6 intel_adsp: Add option about switch off hpsram
Add an option to control whether or not hpsram banks should
be switched off during the power down. This is particular useful
when running tests because we don't want to lose the contents
of the memory window before we capture it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-07-28 08:30:26 -04:00
Lucas Tamborrino
47515f4d7b soc: xtensa: esp32s3: Add external ram noinit section
Add section to allocate memory of WiFi and NET stack in SPIRAM

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-07-26 14:42:20 +02:00
Lucas Tamborrino
c435dea191 soc: xtensa: esp32s3: add support for SPIRAM
Add support for external PSRAM for esp32s3.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-07-26 14:42:20 +02:00
Iuliana Prodan
1295283a8a soc: xtensa: nxp: add resource_table section in linker script
Add resource_table section in linker script for nxp_adsp_imx8m
for inter-process communication.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-07-26 14:33:36 +02:00
Marek Matej
6b57b3b786 soc: xtensa,riscv: esp32xx: refactor folder structure
Refactor the ESP32 target SOCs together with
all related boards. Most braking changes includes:

- changing the CONFIG_SOC_ESP32* to refer to
  the actual soc line (esp32,esp32s2,esp32s3,esp32c3)
- replacing CONFIG_SOC with the CONFIG_SOC_SERIES
- creating CONFIG_SOC_FAMILY_ESP32 to embrace all
  the ESP32 across all used architectures
- introducing CONFIG_SOC_PART_NUMBER_* to
  provide a SOC model config
- introducing the 'common' folder to hide all
  commonly used configs and files.
- updating west.yml to reflect previous changes in hal

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-25 18:12:33 +02:00
Gerard Marull-Paretas
f603061938 soc: xtensa: intel_adsp: cavs: fix PM hooks guards
The PM hooks were guarded with CONFIG_PM_POLICY_CUSTOM, however, they
need to be guarded (if file is always compiled) with CONFIG_PM. In fact,
CONFIG_PM_POLICY_CUSTOM requires to implement a custom policy hook,
something this module did not provide.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Gerard Marull-Paretas
55f5a75c58 pm: remove unnecessary __weak from pm_state_set/pm_exit_post_ops
Remove unnecessary __weak attribute from power management functions.
These functions are now defined once, globally, and mandatory for
systems that support CONFIG_PM.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Gerard Marull-Paretas
3d2194f11e pm: introduce HAS_PM
Add a new Kconfig option that has to be selected by SoCs providing PM
hooks. This option will be now required to enable CONFIG_PM. Before this
change, CONFIG_PM could always be enabled, regardless of SoC providing
any kind of low-power support.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Daniel Leung
e55fb88bcb soc: intel_adsp/ace: update clock rate
The clock rates for ACE series of Intel Audio DSP have changed.
The values come from the SOF project in their board configs.

CONFIG_XTENSA_CCOUNT_HZ is also set so the arch timing test
can pass.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-07-17 16:27:08 -04:00
Marc Herbert
35e8e6fa03 soc/xtensa/nxp_adsp/CMakeLists.txt: use new WEST_SIGN_OPTS variable
Align `soc/nxp_adsp` with new `WEST_SIGN_OPTS` option added to
`soc/intel_adsp` by recent commit d98a7c2f8d ("soc: xtensa: cmake: add
new WEST_SIGN_OPTS variable").

This allows per-board rimage customization at the CMake level. Example
in `zephyr/boards/xtensa/nxp_adsp_NEWBOARD/board.cmake`:

  set(WEST_SIGN_OPTS -- -c rimage/config/special.toml)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-07-13 14:19:26 +02:00
Daniel Leung
25c6553edd soc: intel_adsp/ace: use functions to do CPU power control
Instead of relying on direct memory access via structs to
control CPU power and status, using inline functions instead
to hide the details. This makes reading the common code a bit
cleaner.

The function names are generic and not architecture or
platform specific, in an attempt to ease future arch or
platform additions with code reuse. Or else we would need to
rename these.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-07-10 16:13:03 +02:00
Tomasz Leman
3764814831 intel_adsp: boot: d3: hp sram reinit
Adding HP SRAM initialization in D3 power state exit procedure.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-07-10 16:08:32 +02:00
Marek Matej
0038620b37 soc: xtensa: disable SPIRAM when MCUBOOT
Some boards has ESP_SPIRAM enabled by default, which is
causing issues when MCUboot is used as 2nd bootloader.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-10 15:10:14 +02:00
Iuliana Prodan
dc49a314fd west: sign.py: fix sign when CONFIG_KERNEL_BIN_NAME is used
This fixes the following build error:
```
zephyr/zephyr.elf', needed by 'zephyr/zephyr.ri', missing and no known
rule to make it
```
This appears when CONFIG_KERNEL_BIN_NAME is used.

Therefore, do not use zephyr.elf since some samples might be called
based on CONFIG_KERNEL_BIN_NAME.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-07-10 09:29:33 +02:00
Keith Packard
710422ec5e include/zephyr: Fix linker scripts to define _end after all static RAM data
The Zephyr linker scripts have inconsistent ordering of various chunks of
data which lands in RAM at runtime. This leads to the value of _end not
being consistently defined as the maximum address of static variables used
in the application.

Create a helper linker fragment, zephyr/linker/ram-end.ld, which can be
included after the last possible definition of RAM data, that consistently
sets _image_ram_end, _end and z_mapped_end.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-06-28 08:41:02 +00:00
Serhiy Katsyuba
431108d89e intel_adsp: ace: Restore IDC interrupt on D3 exit
After exiting D3 state if IMR context save is enabled, IDC interrupt
must be re-enabled again for all cores.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2023-06-28 06:50:27 +00:00
Anas Nashif
7584c17374 intel_adsp: restructure dmic headers and move regs to soc
The ifdefs in in dmic headers is getting out of control and makes
maintainence very ddifficult, especially when having to maintain out of
tree SoCs sharing the same data and information.

Keep header clean and per SoC and share some common registers in one
place instead avoiding confusion and making it easier to read and
maintain.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-23 14:27:44 -04:00
Anas Nashif
c62e55973b intel_adsp: remove deprecated cache macros
SOC_DCACHE_FLUSH and SOC_DCACHE_INVALIDATE are not being used anywhere.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-23 11:14:08 -04:00
Andrey Borisovich
23b3cae1b1 inte_adsp: ipc: prevent ipc message send during Device power transition
When CONFIG_PM_DEVICE is enabled IPC Device may be during power transition
during a call to intel_adsp_ipc_send_message function.
Changed signatures of intel_adsp_ipc_send_message and its sync version
to return int and negative error codes on error.
On attempt to send IPC message during Device power transition
-ESHUTDOWN error code is returned, on busy state -EBUSY.
Updated all function references.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2023-06-22 06:14:57 -04:00
Andrey Borisovich
355f8cfe4f intel_adsp: ipc: device support D3 power state change
When option CONFIG_PM_DEVICE is enabled, IPC driver is capable
of entering D3 power state described as PM_DEVICE_ACTION_SUSPEND
(and leaving that state - powering back to PM_DEVICE_ACTION_ACTIVE).
New power control callbacks 'ipc_power_control_api' are introduced for
use during power state transisions. They allow Zephyr application
specific code to be executed.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2023-06-22 06:14:57 -04:00
Andrey Borisovich
1d58b1b83f intel_adsp: mem_window: reinitialize after idle exit
Exiting idle state requires to reinitialize all memory window
instances to flush the cached memory.
Added function that calls initialization of devices during runtime.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2023-06-22 06:14:57 -04:00
Andrey Borisovich
7595cafb02 intel_adsp: timer: implemented sys_clock_idle_exit function
Generic header for system clock allows to define a sys_clock_idle_exit
function for the clock implementation.
Implemented the function in the intel_adsp_timer to reinitialize
device driver after the idle exit state.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2023-06-22 06:14:57 -04:00
Lucas Tamborrino
e229898caf drivers: pinctrl: esp32xx: allow internal loopback
Provides a way to use pinctrl to allow internal loopback
on a peripheral pin for testing purposes.
This is done by using output-enable on a input pin and
input-enable on a output pin.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-06-22 08:13:36 +00:00
Lucas Tamborrino
ba3766a75f debug: coredump: xtensa: add esp32s2
Add coredump support for esp32s2.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-06-21 16:06:06 -04:00
Adrian Warecki
64b2246dbc soc: adsp: clk: Add multiple clock sources support for dai
Added a new function to check whether a clock source is supported by a
platform and to retrieve its frequency.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-06-20 14:19:13 -04:00
Adrian Warecki
1a4bc7580b adsp: Rename cpu clock related functions
The word cpu was added to the names of functions, structs, types
and definitions to disambiguate the names and make room in the namespace
for soc clock control functions.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-06-20 14:19:13 -04:00
Adrian Warecki
b9e5cf5110 adsp: ace: ace_dfpmccu structure field description
Added ace_dfpmccu structure field descriptions to make the code more
readable.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-06-20 14:19:13 -04:00
Jaska Uimonen
a8b28f13c1 soc: intel_adsp: cavs: add simple IMR functionality
Add simple mechanism to load the image from IMR memory. Basically we are
only setting a flag in power off for the next boot to jump to existing
image in IMR.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-06-20 09:28:56 +01:00
Jaska Uimonen
339b00de11 soc: xtensa: intel_adsp: fix memory bank shutdown
Amount of memory banks should vary depending on platform, otherwise
power down sequence might result in ipc timeout as the memory used by
the ipc itself is shutdown.

Lift the needed defines from sram.c to adsp_memory.h and shorten the
names to avoid collision with sof code. No functional change to sram.c.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-06-17 07:31:11 -04:00
Flavio Ceolin
5dfaf23f47 xtensa: intel_adsp: lnl: Fix dspcs struct
This is struct is used to access to contiguous registers for each core
and lnl has 5.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-06-17 07:30:21 -04:00
Gerard Marull-Paretas
c59b57c0be soc: esp32*: do not enable HAS_DYNAMIC_DEVICE_HANDLES
It doesn't make sense to select this option at SoC level. This feature
is meant for subsystems/modules that need device handles to be
modifiable at runtime.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-15 10:09:26 -04:00
Pierre-Louis Bossart
b871138fae soc/intel_adsp: fix typo in L1EXP definition
The field offset is incorrect, L1EXP is at bit 24 and L1ETP at bit 25.

Fixes: cc6e9c094a ("soc/intel_adsp: Low level HDA driver and tests")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2023-06-06 17:20:01 -04:00
Marc Herbert
d98a7c2f8d soc: xtensa: cmake: add new WEST_SIGN_OPTS variable
This allows per-board rimage customization.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-06-02 15:07:59 -04:00
Marek Matej
02d157b8db soc: esp32: Update soc startup and cache init
Updated the cache init functions
and clean-up the soc startup function.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-06-01 10:05:20 +02:00
Marek Matej
548e8b717d soc: esp32: Fix linker scripts
Updated the flash segment alignment on S3,
so that mapping corresponds with the linkage.
Fixed hard-coded flash size for ESP32.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-06-01 10:05:20 +02:00
Kai Vehmanen
aa5b66be5f intel_adsp: cavs25: configure access to ALH
For Intel cavs2.5, access from LPGPDMAC to Audio Link Hub
RX/TX registers needs to be explicitly enabled before use.

The logic follow hardware initialization done in
SOF project sof/src/platform/intel/cavs/platform.c

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-05-30 10:50:02 -04:00
Anas Nashif
8e3437461d soc: intel_adsp: remove obsolete headers for cAVS platforms
The SoCs/Boards using those headers were dropped, so remove those
remaining headers that were forgotten.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-26 09:06:12 -04:00