Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 15 additions & 62 deletions boards/mediatek/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ Mediatek Audio DSPs

Zephyr can be built and run on the Audio DSPs included in various
members of the Mediatek MT8xxx series of ARM SOCs used in Chromebooks
from various manufacturers.
from various manufacturers and Mediatek Genio evaluations kits.

Two of these DSPs are in the market already, implemented via the
MT8195 ("Kompanio 1380") and MT8186 ("Kompanio 520") SOCs.
Development has been done on and validation performed on at least
these devices, though more exist:
Four of these DSPs are in the market already, implemented via the
MT8195 ("Kompanio 1380", MT8186 ("Kompanio 520"), MT8188 ("Kompanio 838")
and MT8365 ("Genio 350 EVK") SOCs. Development has been done on and
validation performed on at least these devices, though more exist:

====== ============= =================================== =================
SOC Product Name Example Device ChromeOS Codename
====== ============= =================================== =================
MT8195 Kompanio 1380 HP Chromebook x360 13b dojo
MT8186 Kompanio 520 Lenovo 300e Yoga Chromebook Gen 4 steelix
MT8188 Kompanio 838 Lenovo Chromebook Duet 11 ciri
MT8365 Genio 350 Genio 350 EVK
====== ============= =================================== =================

Hardware
Expand Down Expand Up @@ -67,7 +69,7 @@ my mt8186 device named "steelix":

.. code-block:: console

user@dev_host:~$ west build -b mt8186//adsp samples/hello_world
user@dev_host:~$ west build -b mt8186/mt8186/adsp samples/hello_world
...
... # build output
...
Expand All @@ -76,8 +78,8 @@ my mt8186 device named "steelix":
user@dev_host:~$ ssh steelix

root@steelix:~ # ./mtk_adsp_load.py load zephyr.img
*** Booting Zephyr OS build v3.6.0-5820-gd2a89b3c089e ***
Hello World! mt8186_adsp/mt8186_adsp
*** Booting Zephyr OS build v4.2.0-4743-g80fdfabcba48 ***
Hello World! mt8186/mt8186/adsp

Debugging
=========
Expand All @@ -93,60 +95,11 @@ but this is still unintegrated.
Toolchains
**********

The MT8195 toolchain is already part of the Zephyr SDK, so builds for
the ``mt8195//adsp`` board should work out of the box simply following
the generic Zephyr build instructions in the Getting Started guide.

The MT8186 toolchain is not, and given the proliferation of Xtensa
toolchains in the SDK may not be. The overlay files for the device
are maintained by the SOF project, however, and building a toolchain
yourself using crosstools-ng is not difficult or time-consuming. This
script should work for most users:

.. code-block:: shell

#!/bin/sh

TC=mtk_mt818x_adsp

# Grab source (these are small)
git clone https://github.com/crosstool-ng/crosstool-ng
git clone https://github.com/thesofproject/xtensa-overlay

# Build ct-ng itself
cd crosstool-ng
./bootstrap
./configure --enable-local
make -j$(nproc)

mkdir overlays
(cd overlays; ln -s ../../xtensa-overlay/xtensa_mt8186.tar.gz xtensa_${TC}.tar.gz)

# Construct a .config file
cat >.config <<EOF
CT_CONFIG_VERSION="3"
CT_EXPERIMENTAL=y
CT_OVERLAY_LOCATION="overlays"
CT_OVERLAY_NAME="${TC}"
CT_ARCH_XTENSA=y
CT_XTENSA_CUSTOM=y
CT_TARGET_VENDOR="${TC}_zephyr"
CT_TARGET_CFLAGS="-ftls-model=local-exec"
CT_CC_GCC_CONFIG_TLS=n
CT_GDB_CROSS_EXTRA_CONFIG_ARRAY="--enable-xtensa-use-target-regnum --disable-xtensa-remote-g-packet"
EOF

# Build
./ct-ng olddefconfig
./ct-ng build.$(nproc)

After this completes, you will find your toolchain in ``~/x-tools``
and can use it to build by setting it as your Zephyr cross compiler:

.. code-block:: shell

export CROSS_COMPILE=$HOME/x-tools/xtensa-mtk_mt818x_adsp_zephyr-elf/bin/xtensa-mtk_mt818x_adsp_zephyr-elf-
export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile
The MT8195, MT818X and MT8365 toolchains are already part of the Zephyr
SDK, so builds for the ``mt8195/mt8195/adsp``, ``mt8186/mt8186/adsp``,
``mt8188/mt8188/adsp`` and ``mt8365/mt8365/adsp`` board should work out
of the box simply following the generic Zephyr build instructions in
the Getting Started guide.

Closed-source Tools
===================
Expand Down
5 changes: 5 additions & 0 deletions boards/mediatek/mt8365/Kconfig.mt8365
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2025 Mediatek
# SPDX-License-Identifier: Apache-2.0

config BOARD_MT8365
select SOC_MT8365
111 changes: 111 additions & 0 deletions boards/mediatek/mt8365/afe-mt8365.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/* Copyright 2025 Mediatek
* SPDX-License-Identifier: Apache-2.0
*/
afe_dl1: afe_dl1 {
compatible = "mediatek,afe";
afe-name = "DL1";
dai-id = <0>;
downlink;
base = <0x00000000 0x11220040>;
cur = <0x00000000 0x11220044>;
end = <0x00000000 0x11220048>;
fs = <0x11220014 0 4>;
mono = <0x11220014 21 1>;
enable = <0x11220010 1 1>;
hd = <0x112203d8 16 1>;
};

afe_dl2: afe_dl2 {
compatible = "mediatek,afe";
afe-name = "DL2";
dai-id = <1>;
downlink;
base = <0x00000000 0x11220050>;
cur = <0x00000000 0x11220054>;
end = <0x00000000 0x11220058>;
fs = <0x11220014 4 4>;
mono = <0x11220014 22 1>;
enable = <0x11220010 2 1>;
hd = <0x112203d8 18 1>;
};

afe_tdm_out: afe_tdm_out {
compatible = "mediatek,afe";
afe-name = "TDM_OUT";
dai-id = <4>;
downlink;
base = <0x00000000 0x11220374>;
cur = <0x00000000 0x11220378>;
end = <0x00000000 0x1122037c>;
enable = <0x11220370 0 1>;
hd = <0x112203d8 28 1>;
};

afe_awb: afe_awb {
compatible = "mediatek,afe";
afe-name = "AWB";
dai-id = <2>;
base = <0x00000000 0x11220070>;
cur = <0x00000000 0x1122007c>;
end = <0x00000000 0x11220078>;
fs = <0x11220014 12 4>;
mono = <0x11220014 24 1>;
enable = <0x11220010 6 1>;
hd = <0x112203d8 20 1>;
msb = <0x112200cc 17 1>;
};

afe_vul: afe_vul {
compatible = "mediatek,afe";
afe-name = "VUL";
dai-id = <3>;
base = <0x00000000 0x11220080>;
cur = <0x00000000 0x1122008c>;
end = <0x00000000 0x11220088>;
fs = <0x11220014 16 4>;
mono = <0x11220014 27 1>;
enable = <0x11220010 3 1>;
hd = <0x112203d8 22 1>;
msb = <0x112200cc 20 1>;
};

afe_vul2: afe_vul2 {
compatible = "mediatek,afe";
afe-name = "VUL2";
dai-id = <5>;
base = <0x00000000 0x11220350>;
cur = <0x00000000 0x1122035c>;
end = <0x00000000 0x11220358>;
fs = <0x11220010 20 4>;
mono = <0x11220010 10 1>;
enable = <0x11220010 9 1>;
hd = <0x112203d8 14 1>;
msb = <0x112200cc 21 1>;
};

afe_vul3: afe_vul3 {
compatible = "mediatek,afe";
afe-name = "VUL3";
dai-id = <6>;
base = <0x00000000 0x112208c0>;
cur = <0x00000000 0x112208c4>;
end = <0x00000000 0x112208c8>;
fs = <0x11220014 8 4>;
mono = <0x11220010 13 1>;
enable = <0x11220010 12 1>;
hd = <0x112203ec 10 1>;
msb = <0x112200cc 27 1>;
};

afe_tdm_in: afe_tdm_in {
compatible = "mediatek,afe";
afe-name = "TDM_IN";
dai-id = <7>;
base = <0x00000000 0x112209c4>;
cur = <0x00000000 0x112209cc>;
end = <0x00000000 0x112209c8>;
mono = <0x112209c0 1 1>;
enable = <0x112209c0 0 1>;
hd = <0x112203ec 8 1>;
msb = <0x112200cc 28 1>;
};
6 changes: 6 additions & 0 deletions boards/mediatek/mt8365/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
boards:
- name: mt8365
full_name: MT8365 ADSP
vendor: mediatek
socs:
- name: mt8365
80 changes: 80 additions & 0 deletions boards/mediatek/mt8365/mt8365_adsp.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/* Copyright 2025 Mediatek
* SPDX-License-Identifier: Apache-2.0
*/
#include <mem.h>

/dts-v1/;
/ {
#address-cells = <1>;
#size-cells = <1>;

sram1: memory@1e000000 {
device_type = "memory";
compatible = "mmio-sram";
reg = <0x1e000000 DT_SIZE_K(416)>;
};

sram0: memory@40020000 {
device_type = "memory";
compatible = "mmio-sram";
reg = <0x40020000 DT_SIZE_K(256)>;
};

dram0: memory@60000000 {
device_type = "memory";
compatible = "mmio-sram";
reg = <0x60000000 DT_SIZE_K(13824)>;
};

dram1: memory@60d80000 {
device_type = "memory";
compatible = "mmio-sram";
reg = <0x60d80000 DT_SIZE_K(2560)>;
};

soc {
#address-cells = <1>;
#size-cells = <1>;

core_intc: core_intc@0 {
compatible = "cdns,xtensa-core-intc";
reg = <0 4>;
interrupt-controller;
#interrupt-cells = <3>;
};

intc1: intc@1d062130 {
compatible = "mediatek,adsp_intc";
interrupt-controller;
#interrupt-cells = <3>;
reg = <0x1d062130 4>;
status-reg = <0x1d062150>;
interrupts = <1 0 0>;
mask = <0x3ff>;
interrupt-parent = <&core_intc>;
};

ostimer64: ostimer64@1d060000 {
compatible = "mediatek,ostimer64";
reg = <0x1d060000 30>;
};

ostimer0: ostimer@1d060040 {
compatible = "mediatek,ostimer";
reg = <0x1d060040 8>;
interrupt-parent = <&core_intc>;
interrupts = <2 0 0>;
};

ipi: ipi@1d062114 {
compatible = "mediatek,ipi";
reg = <0x1d062114 4>;
interrupt-parent = <&intc1>;
interrupts = < 9 0 0 >;
};

/* Generated code for AFE devices */
#include "afe-mt8365.dts"

}; /* soc */
};
11 changes: 11 additions & 0 deletions boards/mediatek/mt8365/mt8365_mt8365_adsp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
identifier: mt8365/mt8365/adsp
name: Mediatek mt8365 Audio DSP
type: mcu
arch: xtensa
toolchain:
- zephyr
testing:
only_tags:
- kernel
- sof
vendor: mediatek
2 changes: 2 additions & 0 deletions boards/mediatek/twister.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ variants:
name: MediaTek MT8186 Audio DSP
mt8196/mt8196/adsp:
name: MediaTek MT8196 Audio DSP
mt8365/mt8365/adsp:
name: MediaTek MT8365 Audio DSP
Loading
Loading