-
Notifications
You must be signed in to change notification settings - Fork 350
Add SOF support for M7 core on NXP i.MX8MP #10556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ae0b04f
3da6af3
e443c07
ff32142
2967033
9fa13ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| CONFIG_IMX8M_CM7=y | ||
| CONFIG_ZEPHYR_NATIVE_DRIVERS=y | ||
| CONFIG_SHARED_INTERRUPTS=y | ||
| CONFIG_CLOCK_CONTROL_FIXED_RATE_CLOCK=y | ||
| CONFIG_ROMSTART_RELOCATION_ROM=y | ||
| CONFIG_DMA_NXP_SOF_HOST_DMA_ALIGN=32 | ||
| CONFIG_DMA=y | ||
| CONFIG_DMA_NXP_SDMA=y | ||
| CONFIG_DAI_NXP_SAI=y | ||
| CONFIG_SAI_HAS_MCLK_CONFIG_OPTION=y | ||
| CONFIG_COMP_ASRC=n | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright 2026 NXP | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| / { | ||
| host_dma: dma { | ||
| compatible = "nxp,sof-host-dma"; | ||
| dma-channels = <32>; | ||
| #dma-cells = <0>; | ||
| }; | ||
| }; | ||
|
|
||
| &sdma3 { | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &sai3 { | ||
| pinctrl-0 = <&sai3_default>; | ||
| pinctrl-names = "default"; | ||
| rx-fifo-watermark = <64>; | ||
| tx-fifo-watermark = <64>; | ||
| fifo-depth = <96>; | ||
| rx-sync-mode = <1>; | ||
| status = "okay"; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause | ||
| * | ||
| * Copyright 2026 NXP | ||
| */ | ||
|
|
||
| #ifdef __SOF_LIB_CLK_H__ | ||
|
|
||
| #ifndef __PLATFORM_LIB_CLK_H__ | ||
| #define __PLATFORM_LIB_CLK_H__ | ||
|
|
||
| #define CLK_MAX_CPU_HZ 800000000 | ||
| #define CPU_DEFAULT_IDX 0 | ||
| #define NUM_CPU_FREQ 1 | ||
| #define NUM_CLOCKS 1 | ||
|
|
||
| struct sof; | ||
|
|
||
| void platform_clock_init(struct sof *sof); | ||
|
|
||
| #endif /* __PLATFORM_LIB_CLK_H__ */ | ||
|
|
||
| #else | ||
|
|
||
| #error "This file shouldn't be included from outside of sof/lib/clk.h" | ||
|
|
||
| #endif /* __SOF_LIB_CLK_H__ */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause | ||
| * | ||
| * Copyright 2026 NXP | ||
| */ | ||
|
|
||
| #ifdef __SOF_LIB_DMA_H__ | ||
|
|
||
| #ifndef __PLATFORM_LIB_DMA_H__ | ||
| #define __PLATFORM_LIB_DMA_H__ | ||
|
|
||
| /* TODO: remove me whenever possible */ | ||
|
|
||
| #endif /* __PLATFORM_LIB_DMA_H__ */ | ||
|
|
||
| #else | ||
|
|
||
| #error "This file shouldn't be included from outside of sof/lib/dma.h" | ||
|
|
||
| #endif /* __SOF_LIB_DMA_H__ */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause | ||
| * | ||
| * Copyright 2026 NXP | ||
| */ | ||
|
|
||
| #ifdef __SOF_LIB_MAILBOX_H__ | ||
|
|
||
| #ifndef __PLATFORM_LIB_MAILBOX_H__ | ||
| #define __PLATFORM_LIB_MAILBOX_H__ | ||
|
|
||
| /* The i.MX8MP CM7 mailbox region is organized like this: | ||
| * | ||
| * +---------------+-------------------------+ | ||
| * | Region name | Base address | Size | | ||
| * +---------------+---------------+---------+ | ||
| * | Outbox region | 0x82000000 | 0x1000 | | ||
| * +---------------+---------------+---------+ | ||
| * | Inbox region | 0x82001000 | 0x1000 | | ||
| * +---------------+---------------+---------+ | ||
| * | Stream region | 0x82002000 | 0x1000 | | ||
| * +---------------+---------------+---------+ | ||
| * | ||
| * IMPORTANT: all regions should be 32-byte aligned. | ||
| * This is required because cache maintenance might | ||
| * be performed on them. | ||
| */ | ||
|
|
||
| /* outbox */ | ||
| #define MAILBOX_DSPBOX_SIZE 0x1000 | ||
| #define MAILBOX_DSPBOX_BASE 0x82000000 | ||
| #define MAILBOX_DSPBOX_OFFSET 0 | ||
|
|
||
| /* inbox */ | ||
| #define MAILBOX_HOSTBOX_SIZE 0x1000 | ||
| #define MAILBOX_HOSTBOX_BASE 0x82001000 | ||
| #define MAILBOX_HOSTBOX_OFFSET (MAILBOX_DSPBOX_OFFSET + MAILBOX_DSPBOX_SIZE) | ||
|
|
||
| /* stream */ | ||
| #define MAILBOX_STREAM_SIZE 0x1000 | ||
| #define MAILBOX_STREAM_BASE 0x82002000 | ||
| #define MAILBOX_STREAM_OFFSET (MAILBOX_HOSTBOX_OFFSET + MAILBOX_HOSTBOX_SIZE) | ||
|
|
||
| #endif /* __PLATFORM_LIB_MAILBOX_H__ */ | ||
|
|
||
| #else | ||
|
|
||
| #error "This file shouldn't be included from outside of sof/lib/mailbox.h" | ||
|
|
||
| #endif /* __SOF_LIB_MAILBOX_H__ */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause | ||
| * | ||
| * Copyright 2026 NXP | ||
| */ | ||
|
|
||
| #ifdef __SOF_LIB_MEMORY_H__ | ||
|
|
||
| #ifndef __PLATFORM_LIB_MEMORY_H__ | ||
| #define __PLATFORM_LIB_MEMORY_H__ | ||
|
|
||
| #include <rtos/cache.h> | ||
|
|
||
| #define PLATFORM_DCACHE_ALIGN DCACHE_LINE_SIZE | ||
|
|
||
| #define SHARED_DATA | ||
|
|
||
| #define uncache_to_cache(address) address | ||
| #define cache_to_uncache(address) address | ||
| #define cache_to_uncache_init(address) address | ||
| #define is_uncached(address) 0 | ||
|
|
||
| /* no address translation required */ | ||
| #define host_to_local(addr) (addr) | ||
| #define local_to_host(addr) (addr) | ||
|
|
||
| #define HEAPMEM_SIZE 0x00010000 | ||
|
|
||
| /* WAKEUP domain MU1 side B */ | ||
| #define MU_BASE 0x30AB0000UL | ||
|
|
||
| static inline void *platform_shared_get(void *ptr, int bytes) | ||
| { | ||
| return ptr; | ||
| } | ||
|
|
||
| #endif /* __PLATFORM_LIB_MEMORY_H__ */ | ||
|
|
||
| #else | ||
|
|
||
| #error "This file shouldn't be included from outside of sof/lib/memory.h" | ||
|
|
||
| #endif /* __SOF_LIB_MEMORY_H__*/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause | ||
| * | ||
| * Copyright 2026 NXP | ||
| */ | ||
|
|
||
| #ifdef __SOF_PLATFORM_H__ | ||
|
|
||
| #ifndef __PLATFORM_PLATFORM_H__ | ||
| #define __PLATFORM_PLATFORM_H__ | ||
|
|
||
| /* refers to M7 core clock - one core, one clock */ | ||
| #define PLATFORM_DEFAULT_CLOCK 0 | ||
|
|
||
| #define HOST_PAGE_SIZE 4096 | ||
|
|
||
| #define PLATFORM_PAGE_TABLE_SIZE 256 | ||
|
|
||
| /* TODO: generous (SOF is usually used with 2 channels at most on i.MX | ||
| * platforms) and (potentially) not true. Can be adjusted later on if | ||
| * need be. | ||
| */ | ||
| #define PLATFORM_MAX_CHANNELS 4 | ||
| /* TODO: same as PLATFORM_MAX_CHANNELS */ | ||
| #define PLATFORM_MAX_STREAMS 5 | ||
|
|
||
| /* WAKEUP domain MU7 side B */ | ||
| #define PLATFORM_IPC_INTERRUPT 97 | ||
|
|
||
| #endif /* __PLATFORM_PLATFORM_H__ */ | ||
|
|
||
| #else | ||
|
|
||
| #error "This file shouldn't be included from outside of sof/platform.h" | ||
|
|
||
| #endif /* __SOF_PLATFORM_H__ */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause | ||
| * | ||
| * Copyright 2026 NXP | ||
| */ | ||
|
|
||
| #ifdef __SOF_TRACE_TRACE_H__ | ||
|
|
||
| #ifndef __PLATFORM_TRACE_TRACE_H__ | ||
| #define __PLATFORM_TRACE_TRACE_H__ | ||
|
|
||
| /* TODO: remove me whenever possible */ | ||
|
|
||
| #endif /* __PLATFORM_TRACE_TRACE_H__ */ | ||
|
|
||
| #else | ||
|
|
||
| #error "This file shouldn't be included from outside of sof/trace/trace.h" | ||
|
|
||
| #endif /* __SOF_TRACE_TRACE_H__ */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // SPDX-License-Identifier: BSD-3-Clause | ||
| /* | ||
| * Copyright 2026 NXP | ||
| */ | ||
|
|
||
| #include <rtos/clk.h> | ||
| #include <sof/lib/notifier.h> | ||
|
|
||
| static const struct freq_table platform_cpu_freq[] = { | ||
| { | ||
| .freq = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC, | ||
| .ticks_per_msec = CONFIG_SYS_CLOCK_TICKS_PER_SEC * 1000, | ||
| }, | ||
| }; | ||
|
|
||
| static struct clock_info platform_clocks_info[NUM_CLOCKS]; | ||
|
|
||
| void platform_clock_init(struct sof *sof) | ||
| { | ||
| int i; | ||
|
|
||
| sof->clocks = platform_clocks_info; | ||
|
|
||
| for (i = 0; i < CONFIG_CORE_COUNT; i++) { | ||
| sof->clocks[i] = (struct clock_info) { | ||
| .freqs_num = NUM_CPU_FREQ, | ||
| .freqs = platform_cpu_freq, | ||
| .default_freq_idx = CPU_DEFAULT_IDX, | ||
| .current_freq_idx = CPU_DEFAULT_IDX, | ||
| .notification_id = NOTIFIER_ID_CPU_FREQ, | ||
| .notification_mask = NOTIFIER_TARGET_CORE_MASK(i), | ||
| .set_freq = NULL, | ||
| }; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,5 @@ | ||||||
| SECTION_PROLOGUE(.fw_metadata,,) | ||||||
| { | ||||||
| KEEP (*(*.fw_metadata)) | ||||||
| . = ALIGN(16); | ||||||
| } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) | ||||||
|
||||||
| } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) | |
| } GROUP_ROM_LINK_IN(ROMABLE_REGION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ticks_per_msec calculation appears incorrect. It should be CONFIG_SYS_CLOCK_TICKS_PER_SEC / 1000 (ticks per millisecond), not multiplied by 1000. Looking at the imx8m platform, it uses a direct value of 800000 (for 800MHz), which represents ticks per millisecond. The current calculation would result in ticks per nanosecond.