Skip to content

Add support for mtk mt8186 platform - #5239

Merged
lgirdwood merged 7 commits into
thesofproject:mainfrom
tinghan-shen:mt8186-upstream
Jan 26, 2022
Merged

lgirdwood merged 7 commits into
thesofproject:mainfrom
tinghan-shen:mt8186-upstream

Conversation

@tinghan-shen

Copy link
Copy Markdown
Contributor

Hi,

I'm a chromebook project developer at Mediatek and working on SOF FW on mt8186.

The other co-worker is Allen Cheng (KuanHsun Cheng).

There are some drivers and platform codes we have been verified on mt8186 EVB.

We want to add mt8186 platform support in sof project.

mt8186: Cadence HiFi-5 DSP, single core, 4 dais , 4 dmas and 48k 16 bits.

Similar to mt8195 except changing the DSP core version.

Please let me know if there is any questions.

Thanks.

@sofci

sofci commented Jan 21, 2022

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

reply test this please to run this test once

@gkbldcig

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@afq984

afq984 commented Jan 21, 2022

Copy link
Copy Markdown
Contributor

test this please

@afq984

afq984 commented Jan 21, 2022

Copy link
Copy Markdown
Contributor

approved the github actions, not sure if I can run intel CI though

@dbaluta

dbaluta commented Jan 21, 2022

Copy link
Copy Markdown
Collaborator

Looks good to me. Do you also have a gcc based toolchain for this? It would be useful to add it in the CI build scripts so that we can catch early if something breaks.

@tinghan-shen

Copy link
Copy Markdown
Contributor Author

Looks good to me. Do you also have a gcc based toolchain for this? It would be useful to add it in the CI build scripts so that we can catch early if something breaks.

Ok, I'll prepare a patch for this.
thanks the advice.

@dbaluta

dbaluta commented Jan 21, 2022

Copy link
Copy Markdown
Collaborator

Ok, I'll prepare a patch for this.
thanks the advice.

You can have a look at https://github.com/thesofproject/crosstool-ng/ for all suppported platforms. I also think we have a repo to upload the toolchain binary?

@lgirdwood i don't remember where we store the toochains.

@lgirdwood

Copy link
Copy Markdown
Member

Ok, I'll prepare a patch for this.
thanks the advice.

You can have a look at https://github.com/thesofproject/crosstool-ng/ for all suppported platforms. I also think we have a repo to upload the toolchain binary?

@lgirdwood i don't remember where we store the toochains.

We need to do

  1. add overlay to xtensa-overlays repo
  2. add config file to crosstool-ng repo (binaries are uploaded to ct-ng downloads section)
  3. add binaries to container usually @marc-hb or @greg-intel can do this.
  4. add to CI (same folks as 3).

@yaochunhung

yaochunhung commented Jan 21, 2022 •

Copy link
Copy Markdown
Contributor

@lgirdwood One thing needs your advise. May I know if qemu is required for CI? or qemu is for git actions? We are preparing qemu for mt8195 now. wenliangwu/qemu@5f259f1 , which is based on v5. 2.0. I am wondering what thing need to do when the qemu patch are ready. Thanks in advance.

@lgirdwood

Copy link
Copy Markdown
Member

@lgirdwood One thing needs your advise. May I know if qemu is required for CI? or qemu is for git actions? We are preparing qemu for mt8195 now. wenliangwu/qemu@5f259f1 , which is based on v5. 2.0. I am wondering what thing need to do when the qemu patch are ready. Thanks in advance.

This can go in the qemu branch and then be added to the CI container. @marc-hb and @greg-intel can help with this.

Fwiw, we are moving towards Renode for emulation (timeline TBD) as it has several key advantages over qemu for our needs. @cujomalainey can give you more details.

@lgirdwood

lgirdwood commented Jan 21, 2022 •

Copy link
Copy Markdown
Member

@kkarask can you comment on the CI, this PR should not fail any Intel specific tests. Good to merge ?

@lgirdwood

Copy link
Copy Markdown
Member

@kkarask can you comment on the CI, this PR should not fail any Intel specific tests. Good to merge ?

Please ignore, it's Jenkins CI.

@lgirdwood

Copy link
Copy Markdown
Member

SOFCI TEST

@lgirdwood

Copy link
Copy Markdown
Member

Retry CI

@cujomalainey

Copy link
Copy Markdown
Contributor

Fwiw, we are moving towards Renode for emulation (timeline TBD) as it has several key advantages over qemu for our needs. @cujomalainey can give you more details.

Unfortunately the timeline has been disrupted a bit due to budget planning schedules being misaligned. Only basic xtensa is working right now with zephyr. Working to get more added.

@marc-hb

marc-hb commented Jan 21, 2022

Copy link
Copy Markdown
Collaborator

Do you also have a gcc based toolchain for this?

May I know if qemu is required for CI? or qemu is for git actions?

Please have a look at the discussions and (small) changes in #5202 that was just merged.

Add xtensa headers for mtk mt8186 platform.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
@marc-hb
marc-hb requested a review from juimonen January 24, 2022 05:25

@marc-hb marc-hb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this PR looks like copy/paste of mt8195

Comment thread scripts/xtensa-build-all.sh Outdated
@marc-hb

marc-hb commented Jan 24, 2022

Copy link
Copy Markdown
Collaborator

@kkarask https://sof-ci.01.org/sof-pr-viewer/#/build/PR5239/build8393711 has very strange and new failures again... is there some major activity going on?

Comment thread src/platform/mt8186/include/platform/drivers/interrupt.h Outdated

@kuanhsuncheng kuanhsuncheng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I check the current .github/workflows/pull-request.yml. there is no mt8195 strategy. should we update also ?

Comment thread src/drivers/mediatek/mt8186/interrupt.c Outdated
Comment thread src/drivers/mediatek/mt8186/interrupt.c Outdated
Comment thread src/drivers/mediatek/mt8186/ipc.c Outdated
Comment thread src/drivers/mediatek/mt8186/timer.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is in units, half of what was read in line 61 from MTK_OSTIMER_CUR_L because of multiplication in line 65, is this correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended. The underlying HW is a 32-bit count-down timer.
It's used to set the difference between the current tick and next tick triggering reschedule.

Comment thread src/drivers/mediatek/mt8186/timer.c Outdated
Comment thread src/platform/mt8186/lib/clk.c Outdated
Comment thread src/platform/mt8186/lib/clk.c Outdated
@marc-hb

marc-hb commented Jan 24, 2022

Copy link
Copy Markdown
Collaborator

I check the current .github/workflows/pull-request.yml. there is no mt8195 strategy. should we update also ?

If you have the gcc toolchain ready in the Docker image then yes of course.

@lgirdwood

Copy link
Copy Markdown
Member

@tinghan-shen @kuanhsuncheng please someone from MTK approve PR before merge.

@cujomalainey

Copy link
Copy Markdown
Contributor

@yaochunhung

Comment thread scripts/xtensa-build-all.sh Outdated
Comment thread src/arch/xtensa/configs/mt8186_defconfig Outdated
Comment thread src/drivers/mediatek/mt8186/interrupt.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious why this is all inline? if you add another call to your macro below it will duplicate all this code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting @lgirdwood this seems rather inflated, what are your thoughts here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, these could be optimized. Lets merge this first and get the build results as we could make the same change to all platforms. @tinghan-shen pls can you try this change and report any size changes to the binary. Thanks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think NXP would see the biggest effect since they have multiple IRQs @dbaluta

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to build mt8186 on both gcc11 and xcc, and compare the size of sof.ri.
No difference on gcc11.
64 bytes larger on xcc after remove "inline".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just disable IDC?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is added to solve build errors. mt8186 doesn't enable the configuration to build src/idc/idc.c.

Comment thread src/platform/mt8186/include/platform/platform.h Outdated
@tinghan-shen

Copy link
Copy Markdown
Contributor Author

Here are the PRs for mt8186 gcc toolchain.

thesofproject/crosstool-ng#12
https://github.com/thesofproject/crosstool-ng/pull/12

@yaochunhung yaochunhung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tinghan-shen @kuanhsuncheng please see my comments and feel free to discuss with me. thanks.

Comment thread src/platform/mt8186/include/platform/drivers/interrupt.h Outdated
Comment thread src/platform/mt8186/include/platform/lib/memory.h Outdated
Comment thread src/platform/mt8186/include/platform/lib/memory.h Outdated
Comment thread src/platform/mt8186/lib/clk.c Outdated
Comment thread src/drivers/mediatek/mt8186/interrupt.c Outdated
Comment thread src/drivers/mediatek/mt8186/ipc.c Outdated
Comment thread src/platform/mt8186/platform.c Outdated
Add memory layout and register address for mtk mt8186

Cache
  I-Cache: 64KB, 4-way Associativity
  D-Cache: 128KB, 4-way Associativity

External Memory
  DRAM: DSP can access DRAM shared with CPU
  L2TCM: 512KB DSP SRAM POOL

Currently, use
phy addr:0x60000000, size:0x1000000
dma phy addr: 0x61000000, size: 0x0100000

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Add interrupt, timer, and ipc drivers for mt8186

mt8186 DSP has 32 interrupts.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
@lgirdwood

Copy link
Copy Markdown
Member

@kkarask can you check CI, as this PR is for MTK platform only and should not fail Intel tests. Thanks !

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to keep the notifier UUID unchanged.

Comment thread src/lib/notifier.c Outdated
@yaochunhung

yaochunhung commented Jan 26, 2022 •

Copy link
Copy Markdown
Contributor

Do you also have a gcc based toolchain for this?

May I know if qemu is required for CI? or qemu is for git actions?

Please have a look at the discussions and (small) changes in #5202 that was just merged.

@marc-hb Thanks for providing information. @lgirdwood has already helped to merge mt8195 qemu patch thesofproject/qemu@b85c079. but I am not sure how to add mt8195 to thesofproject/sofqemu (it looks like here https://hub.docker.com/r/thesofproject/sofqemu/tags )and still anything to do except add platform information to pull-request.yml. Besides, may I need to add docker_build like
66234f0#diff-edde3c23b72c58bc38db847aede15fb3e20078318397825da9a7ef2fa48801b5? Please help to advice. Thanks.

mt8186 platform integrates a single-core HIFI5 DSP.

The DSP operates at different highest clock frequencies with corresponding
voltage, 800MHz(0.8v)/400MHz(0.7v)/300MHz(0.65v)/26MHz(0.6v).

The DSP core and DMA in DSP subsys both can access DRAM directly.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Add default config for mt8186 platform.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Add CMakefile for mtk mt8186 platform to build.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Add mt8186 to Kconfig

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.