summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorandy.hu <andy.hu@starfivetech.com>2023-08-17 11:50:20 +0300
committerandy.hu <andy.hu@starfivetech.com>2023-08-17 11:50:20 +0300
commit10b79a67b5da4eb689c03324075d4dd547dc0683 (patch)
tree4caaca55dab5252c524bc74364a398ef8f62056f /arch
parenta08ebe48530539fde3b5b164e0ac13fbd19e1d42 (diff)
parent4e78e41d8b913388728b04244f55b049754b107d (diff)
downloadlinux-10b79a67b5da4eb689c03324075d4dd547dc0683.tar.xz
Merge branch 'CR_4379_hifi_sof_515_carter.li' into 'vf2-515-devel'
CR_4379: sound:hifi4: Sound Open Firmware for hifi4 on vf2 See merge request sbc/linux!138
Diffstat (limited to 'arch')
-rw-r--r--arch/riscv/boot/dts/starfive/Makefile1
-rw-r--r--arch/riscv/boot/dts/starfive/codecs/sof_wm8960.dtsi84
-rwxr-xr-xarch/riscv/boot/dts/starfive/jh7110-common.dtsi13
-rw-r--r--arch/riscv/boot/dts/starfive/jh7110-visionfive-v2-sof-wm8960.dts36
-rw-r--r--arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dts40
-rwxr-xr-xarch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtsi16
-rwxr-xr-xarch/riscv/boot/dts/starfive/jh7110.dtsi14
-rw-r--r--arch/riscv/configs/starfive_visionfive2_defconfig8
8 files changed, 184 insertions, 28 deletions
diff --git a/arch/riscv/boot/dts/starfive/Makefile b/arch/riscv/boot/dts/starfive/Makefile
index 93fd8db63f47..9919dcdb9839 100644
--- a/arch/riscv/boot/dts/starfive/Makefile
+++ b/arch/riscv/boot/dts/starfive/Makefile
@@ -15,4 +15,5 @@ dtb-$(CONFIG_SOC_STARFIVE_JH7110) += jh7110-visionfive-v2.dtb \
jh7110-visionfive-v2-A10.dtb \
jh7110-visionfive-v2-A11.dtb \
jh7110-visionfive-v2-wm8960.dtb \
+ jh7110-visionfive-v2-sof-wm8960.dtb \
jh7110-visionfive-v2-ac108.dtb
diff --git a/arch/riscv/boot/dts/starfive/codecs/sof_wm8960.dtsi b/arch/riscv/boot/dts/starfive/codecs/sof_wm8960.dtsi
new file mode 100644
index 000000000000..8295b3918533
--- /dev/null
+++ b/arch/riscv/boot/dts/starfive/codecs/sof_wm8960.dtsi
@@ -0,0 +1,84 @@
+&sound6 {
+ /* sof + wm8960 */
+ simple-audio-card,dai-link@0 {
+ reg = <0>;
+ format = "dsp_a";
+ bitclock-master = <&sndcodec1>;
+ frame-master = <&sndcodec1>;
+
+ widgets = "Microphone", "Mic Jack",
+ "Line", "Line In",
+ "Line", "Line Out",
+ "Speaker", "Speaker",
+ "Headphone", "Headphone Jack";
+ routing = "Headphone Jack", "HP_L",
+ "Headphone Jack", "HP_R",
+ "Speaker", "SPK_LP",
+ "Speaker", "SPK_LN",
+ "LINPUT1", "Mic Jack",
+ "LINPUT3", "Mic Jack",
+ "RINPUT1", "Mic Jack",
+ "RINPUT2", "Mic Jack",
+ "Playback", "SSP0.OUT",
+ "SSP0.IN", "Capture";
+
+ cpu {
+ sound-dai = <&sof_tdm>;
+ };
+
+ plat {
+ sound-dai = <&sof_dsp>;
+ };
+
+ sndcodec1:codec {
+ sound-dai = <&wm8960>;
+ clocks = <&wm8960_mclk>;
+ clock-names = "mclk";
+ };
+ };
+};
+
+&soc {
+ sof_tdm: sof-tdm@0 {
+ compatible = "starfive,jh7110-sof-dai";
+ reg = <0x0 0x10090000 0x0 0x1000>;
+ reg-names = "tdm";
+ clocks = <&clkgen JH7110_TDM_CLK_AHB>,
+ <&clkgen JH7110_TDM_CLK_APB>,
+ <&clkgen JH7110_TDM_INTERNAL>,
+ <&tdm_ext>,
+ <&clkgen JH7110_TDM_CLK_TDM>,
+ <&clkgen JH7110_MCLK_INNER>;
+ clock-names = "clk_tdm_ahb", "clk_tdm_apb",
+ "clk_tdm_internal", "clk_tdm_ext",
+ "clk_tdm", "mclk_inner";
+ resets = <&rstgen RSTN_U0_TDM16SLOT_AHB>,
+ <&rstgen RSTN_U0_TDM16SLOT_APB>,
+ <&rstgen RSTN_U0_TDM16SLOT_TDM>;
+ reset-names = "tdm_ahb", "tdm_apb", "tdm_rst";
+ #sound-dai-cells = <0>;
+ status = "disabled";
+ };
+};
+
+
+&sof_dsp {
+ #sound-dai-cells = <0>;
+ compatible = "starfive,vf2-dsp-v1";
+ firmware-name = "sof-vf2.ri";
+ tplg-name = "sof-vf2-wm8960.tplg";
+ machine-drv-name = "asoc-simple-card";
+ status = "disabled";
+};
+
+&dma {
+ dma-channels = <2>;
+ snps,priority = <0 1>;
+ snps,block-size = <65536 65536>;
+};
+
+&sof_tdm {
+ pinctrl-names = "default";
+ pinctrl-0 = <&tdm0_pins>;
+ status = "disabled";
+}; \ No newline at end of file
diff --git a/arch/riscv/boot/dts/starfive/jh7110-common.dtsi b/arch/riscv/boot/dts/starfive/jh7110-common.dtsi
index 987fbba5a587..054997b44290 100755
--- a/arch/riscv/boot/dts/starfive/jh7110-common.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7110-common.dtsi
@@ -62,11 +62,8 @@
reg = <0x0 0x6ce00000 0x0 0x1600000>;
};
- xrp_reserved: xrpbuffer@f0000000 {
- reg = <0x0 0x69c00000 0x0 0x01ffffff
- 0x0 0x6bc00000 0x0 0x00001000
- 0x0 0x6bc01000 0x0 0x00fff000
- 0x0 0x6cc00000 0x0 0x00001000>;
+ hifi4_reserved: hifi4@f0000000 {
+ reg = <0x0 0x69c00000 0x0 0x03001000>;
};
};
@@ -751,7 +748,7 @@
status = "disabled";
};
-&xrp {
- memory-region = <&xrp_reserved>;
- status = "okay";
+&sof_dsp {
+ memory-region = <&hifi4_reserved>;
+ status = "disabled";
};
diff --git a/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2-sof-wm8960.dts b/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2-sof-wm8960.dts
new file mode 100644
index 000000000000..8be56ab74e3b
--- /dev/null
+++ b/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2-sof-wm8960.dts
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/*
+ * Copyright (C) 2022 StarFive Technology Co., Ltd.
+ * Copyright (C) 2022 Hal Feng <hal.feng@starfivetech.com>
+ */
+
+/dts-v1/;
+#include "jh7110-visionfive-v2.dts"
+#include "codecs/sof_wm8960.dtsi"
+
+&i2c0 {
+ status = "okay";
+ wm8960: codec@1a {
+ compatible = "wlf,wm8960";
+ reg = <0x1a>;
+ #sound-dai-cells = <0>;
+
+ wlf,shared-lrclk;
+ };
+};
+
+&pdm {
+ status = "disabled";
+};
+
+&mailbox_client0 {
+ status = "disabled";
+};
+
+&sof_tdm {
+ status = "okay";
+};
+
+&sof_dsp {
+ status = "okay";
+}; \ No newline at end of file
diff --git a/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dts b/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dts
index 9e4563355cc4..2cdf93d849d6 100644
--- a/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dts
+++ b/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dts
@@ -212,6 +212,40 @@
starfive,pin-gpio-doen = <OEN_HIGH>;
};
};
+
+ tdm0_pins: tdm0-pins {
+ tdm0-pins-tx {
+ starfive,pins = <PAD_GPIO44>;
+ starfive,pinmux = <PAD_GPIO44_FUNC_SEL 0>;
+ starfive,pin-ioconfig = <IO(GPIO_IE(1))>;
+ starfive,pin-gpio-dout = <GPO_TDM0_PCM_TXD>;
+ starfive,pin-gpio-doen = <OEN_LOW>;
+ };
+
+ tdm0-pins-rx {
+ starfive,pins = <PAD_GPIO61>;
+ starfive,pinmux = <PAD_GPIO61_FUNC_SEL 0>;
+ starfive,pin-ioconfig = <IO(GPIO_IE(1))>;
+ starfive,pin-gpio-doen = <OEN_HIGH>;
+ starfive,pin-gpio-din = <GPI_TDM0_PCM_RXD>;
+ };
+
+ tdm0-pins-sync {
+ starfive,pins = <PAD_GPIO63>;
+ starfive,pinmux = <PAD_GPIO63_FUNC_SEL 0>;
+ starfive,pin-ioconfig = <IO(GPIO_IE(1))>;
+ starfive,pin-gpio-doen = <OEN_HIGH>;
+ starfive,pin-gpio-din = <GPI_TDM0_PCM_SYNCIN>;
+ };
+
+ tdm0-pins-pcmclk {
+ starfive,pins = <PAD_GPIO38>;
+ starfive,pinmux = <PAD_GPIO38_FUNC_SEL 0>;
+ starfive,pin-ioconfig = <IO(GPIO_IE(1))>;
+ starfive,pin-gpio-doen = <OEN_HIGH>;
+ starfive,pin-gpio-din = <GPI_TDM0_CLK_SLV>;
+ };
+ };
};
&uart0 {
@@ -257,3 +291,9 @@
clocks = <&clkgen JH7110_CPU_CORE>;
clock-names = "cpu";
};
+
+&tdm {
+ pinctrl-names = "default";
+ pinctrl-0 = <&tdm0_pins>;
+ status = "disabled";
+};
diff --git a/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtsi b/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtsi
index 0c2d39b96c32..c03d63acb281 100755
--- a/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtsi
@@ -67,11 +67,8 @@
reg = <0x0 0x6ce00000 0x0 0x1600000>;
};
- xrp_reserved: xrpbuffer@f0000000 {
- reg = <0x0 0x69c00000 0x0 0x01ffffff
- 0x0 0x6bc00000 0x0 0x00001000
- 0x0 0x6bc01000 0x0 0x00fff000
- 0x0 0x6cc00000 0x0 0x00001000>;
+ hifi4_reserved: hifi4@f0000000 {
+ reg = <0x0 0x69c00000 0x0 0x03001000>;
};
};
@@ -962,13 +959,12 @@
status = "okay";
};
-&xrp {
- memory-region = <&xrp_reserved>;
- status = "okay";
-};
-
&ptc {
pinctrl-names = "default";
pinctrl-0 = <&pwm_pins>;
status = "okay";
};
+
+&sof_dsp {
+ memory-region = <&hifi4_reserved>;
+};
diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi
index 96a6af93134f..1998e00fe8de 100755
--- a/arch/riscv/boot/dts/starfive/jh7110.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi
@@ -1831,25 +1831,21 @@
dsp@0 {};
};
- xrp: xrp@0 {
- compatible = "cdns,xrp";
+ sof_dsp: sof_dsp@0 {
+ compatible = "starfive,vf2-dsp-v1";
dma-coherent;
- reg = <0x0 0x10230000 0x0 0x00010000
- 0x0 0x10240000 0x0 0x00010000>;
+ reg = <0x0 0x20020000 0x0 0x10000>;
clocks = <&clkgen JH7110_HIFI4_CLK_CORE>;
clock-names = "core_clk";
resets = <&rstgen RSTN_U0_HIFI4_CORE>,
<&rstgen RSTN_U0_HIFI4_AXI>;
reset-names = "rst_core","rst_axi";
starfive,stg-syscon = <&stg_syscon>;
- firmware-name = "hifi4_elf";
+ mbox-names = "tx", "rx";
+ mboxes = <&mailbox_contrl0 0 1>,<&mailbox_contrl0 1 0>;
#address-cells = <1>;
#size-cells = <1>;
- ranges = <0x40000000 0x0 0x20000000 0x040000
- 0x69c00000 0x0 0x69c00000 0x03000000>;
status = "disabled";
- dsp@0 {
- };
};
starfive_cpufreq: starfive,jh7110-cpufreq {
diff --git a/arch/riscv/configs/starfive_visionfive2_defconfig b/arch/riscv/configs/starfive_visionfive2_defconfig
index 33da26c24939..dc2e540d1f01 100644
--- a/arch/riscv/configs/starfive_visionfive2_defconfig
+++ b/arch/riscv/configs/starfive_visionfive2_defconfig
@@ -233,9 +233,15 @@ CONFIG_SND=y
CONFIG_SND_USB_AUDIO=y
CONFIG_SND_SOC=y
CONFIG_SND_DESIGNWARE_I2S=y
+CONFIG_SND_SOC_SOF_TOPLEVEL=y
+CONFIG_SND_SOC_SOF_OF=y
+CONFIG_SND_SOC_SOF_STARFIVE_TOPLEVEL=y
+CONFIG_SND_SOC_SOF_STARFIVE_SUPPORT=y
+CONFIG_STARFIVE_DSP=y
CONFIG_SND_SOC_STARFIVE=y
CONFIG_SND_SOC_STARFIVE_PWMDAC=y
CONFIG_SND_SOC_STARFIVE_I2S=y
+CONFIG_SND_SOC_STARFIVE_SOF_TDM_DAI=y
CONFIG_SND_SOC_AC108=y
CONFIG_SND_SOC_WM8960=y
CONFIG_SND_SIMPLE_CARD=y
@@ -322,7 +328,7 @@ CONFIG_DMATEST=y
CONFIG_GOLDFISH=y
CONFIG_STARFIVE_TIMER=y
CONFIG_MAILBOX=y
-CONFIG_STARFIVE_MBOX=m
+CONFIG_STARFIVE_MBOX=y
CONFIG_STARFIVE_MBOX_TEST=m
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_RPMSG_CHAR=y