diff --git a/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts b/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts index 52b7119b4b40..903661bcf0af 100644 --- a/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts +++ b/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts @@ -15,6 +15,7 @@ #include "hisi_6421v600_pmic_spmi.dtsi" #include "kirin970-gpu.dtsi" #include "kirin970-ion.dtsi" +#include "kirin970_ipc.dtsi" #include "kirin970-coresight.dtsi" #include "kirin970-drm.dtsi" / { diff --git a/arch/arm64/boot/dts/hisilicon/kirin970_ipc.dtsi b/arch/arm64/boot/dts/hisilicon/kirin970_ipc.dtsi new file mode 100755 index 000000000000..99d276358376 --- /dev/null +++ b/arch/arm64/boot/dts/hisilicon/kirin970_ipc.dtsi @@ -0,0 +1,421 @@ +/* + * Hisilicon Ltd. Kirin SoC + * + * Copyright (C) 2012-2014 Hisilicon Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * publishhed by the Free Software Foundation. + * + * mailbox-allocation-table + * ipc-channel SOURCE DESTINATION remark + * mailbox-0 LPM3 GIC_1 ADC + * mailbox-1 DEFAULT GIC_1 RDR + * mailbox-2 HIFI GIC_1 HIFI + * mailbox-3 DEFAULT GIC_1 RESERVED + * mailbox-4 IOM3 GIC_1 IOM3 + * mailbox-5 IVP GIC_2 IVP + * mailbox-6 DEFAULT GIC_2 RESERVED + * mailbox-7 DEFAULT GIC_2 RESERVED + * mailbox-8 ISP GIC_2 ISP + * mailbox-9 ISP GIC_2 ISP + * mailbox-10 GIC_1 IOM3 IOM3 + * mailbox-11 GIC_1 IOM3 RESERVED + * mailbox-12 LPM3 IOM3 LPM3 + * mailbox-13 GIC_1 LPM3 CLOCK + * mailbox-14 GIC_2 LPM3 IP_REGULATOR + * mailbox-15 IOM3 LPM3 IOM3 + * mailbox-16 GIC_1 LPM3 ADC/MODEM PANIC + * mailbox-17 GIC_2 LPM3 RDR + * mailbox-18 GIC_2 HIFI HIFI + * mailbox-19 GIC_1 MODEM-A9 RESERVED + * mailbox-20 GIC_1 MODEM-A9 RESERVED + * mailbox-21 GIC_1 MODEM-A9 RESERVED + * mailbox-22 GIC_1 MODEM-BBE16 RESERVED + * mailbox-23 GIC_1 ISP ISP + * mailbox-24 GIC_1 ISP ISP + * mailbox-25 GIC_1 IVP32 IVP + * mailbox-26 GIC_1 IVP32 IVP + * mailbox-27 GIC_1 LPM3 HISEE/DDR + * mailbox-28 GIC_1 LPM3 TSENSOR + * mailbox-29 GIC_1 HIFI BSP_RESET_CORE_NOTIFY + * mailbox-30 GIC_COMM COMM RESERVED + */ + + /{ + hisi_ipc: ipc@e896b000 { + #address-cells = <2>; + #size-cells = <2>; + compatible = "hisilicon,HiIPCV230"; + reg = <0x0 0xe896b000 0x0 0x1000>; + interrupts = <0 192 4>, <0 193 4>; + clocks = <&pclk>; + clock-names = "apb_pclk"; + unlock_key = <0x1ACCE551>; + capability = <8>; + hardware_board_type = <0>; /* 1:udp & fpga 0:others */ + status = "ok"; + + /* + * "func" + * ; + * + * "src_bit" & "des_bit" + * <0: GIC_1>; + * <1: GIC_2>; + * <2: IOM7>; + * <3: LPM3>; + * <4: HIFI>; + * <5: MODEM_A9>; + * <6: MODEM_BBE16>; + * <7: IVP>; + * <8: ISP>; + * <9: COMM>; + * + * "index" + * software encoded the index of different ipc-mailbox, + * if add new ipc, please add 100 in new ipc-dtsi, + * example: + * Kernel-PERI-IPC: 0~99; ISP-IPC: 100~199; NEW-IPC: 200~299 + * + * "used" + * <1: using 0: unused> + * + * "timeout" + * <300> means TIMEOUT time is 300ms, + * timeout must be multiple of 5ms,such as 305; + * + * "fifo_size" + * <8> means IPC async send tx_thread_fifo is 8; + * + * "sched_priority" + * <1: highest priority 20: default priority> + * + * "sched_policy" + * <1: SCHED_FIFO 2: SCHED_RR 2:default policy> + * + * don't forget to increase the number of mailbox + * when add or decrease a mailbox channel + */ + mailboxes = <25>; + mailbox-0 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 197 4>; + src_bit = <3>; + des_bit = <0>; + index = <0>; + used = <1>; + timeout = <300>; + }; + + mailbox-1 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 198 4>; + src_bit = <3>; + des_bit = <0>; + index = <1>; + used = <1>; + timeout = <300>; + }; + + mailbox-2 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 199 4>; + src_bit = <4>; + des_bit = <0>; + index = <2>; + used = <1>; + timeout = <300>; + }; + + mailbox-3 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 200 4>; + src_bit = <3>; + des_bit = <0>; + index = <3>; + used = <1>; + timeout = <300>; + }; + + mailbox-4 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 201 4>; + src_bit = <2>; + des_bit = <0>; + index = <4>; + used = <1>; + timeout = <300>; + }; + + mailbox-5 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 202 4>; + src_bit = <7>; + des_bit = <1>; + index = <5>; + used = <1>; + timeout = <300>; + }; + + mailbox-6 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 203 4>; + src_bit = <7>; + des_bit = <1>; + index = <6>; + used = <1>; + timeout = <300>; + }; + mailbox-7 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 204 4>; + src_bit = <3>; + des_bit = <1>; + index = <7>; + used = <0>; + timeout = <300>; + }; + mailbox-8 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 205 4>; + src_bit = <8>; + des_bit = <1>; + index = <8>; + used = <1>; + timeout = <300>; + }; + + mailbox-9 { + compatible = "HiIPCV230,rx-mailbox-fast"; + func = <1 0 1>; + interrupts = <0 206 4>; + src_bit = <8>; + des_bit = <1>; + index = <9>; + used = <1>; + timeout = <300>; + }; + mailbox-10 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <2>; + index = <10>; + used = <1>; + timeout = <300>; + }; + + mailbox-11 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <2>; + index = <11>; + used = <1>; + timeout = <300>; + }; + + mailbox-12 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <2>; + index = <12>; + used = <1>; + timeout = <300>; + }; + + mailbox-13 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <3>; + index = <13>; + used = <1>; + timeout = <300>; + fifo_size = <8>; + sched_priority = <1>; + sched_policy = <1>; + }; + + mailbox-14 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <1>; + des_bit = <3>; + index = <14>; + used = <1>; + timeout = <300>; + }; + + mailbox-15 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <3>; + index = <15>; + used = <1>; + timeout = <300>; + }; + + mailbox-16 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <3>; + index = <16>; + used = <1>; + timeout = <300>; + }; + + mailbox-17 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <1>; + des_bit = <3>; + index = <17>; + used = <1>; + timeout = <300>; + }; + + mailbox-18 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <1>; + des_bit = <4>; + index = <18>; + used = <1>; + timeout = <300>; + }; + mailbox-19 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <5>; + index = <19>; + used = <0>; + timeout = <300>; + }; + + mailbox-20 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <5>; + index = <20>; + used = <0>; + timeout = <300>; + }; + + mailbox-21 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <5>; + index = <21>; + used = <0>; + timeout = <300>; + }; + + mailbox-22 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <6>; + index = <22>; + used = <0>; + timeout = <300>; + }; + mailbox-23 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <8>; + index = <23>; + used = <1>; + timeout = <300>; + }; + + mailbox-24 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <8>; + index = <24>; + used = <0>; + timeout = <300>; + }; + mailbox-25 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <7>; + index = <25>; + used = <1>; + timeout = <300>; + }; + + mailbox-26 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <7>; + index = <26>; + used = <1>; + timeout = <300>; + }; + + mailbox-27 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <3>; + index = <27>; + used = <1>; + timeout = <300>; + }; + + mailbox-28 { + compatible = "HiIPCV230,tx-mailbox-fast"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <3>; + index = <28>; + used = <1>; + timeout = <300>; + }; + /* The mailbox-29 and mailbox-30 is comm-mailbox in SOC, + * but fast-mailbox in software, define the src and des here, + * if need use, add it below + */ + mailbox-29 { + compatible = "HiIPCV230,mailbox-comm"; + func = <1 1 0>; + src_bit = <0>; + des_bit = <4>; + index = <29>; + used = <1>; + timeout = <300>; + }; + + mailbox-30 { + compatible = "HiIPCV230,mailbox-comm"; + func = <1 1 0>; + src_bit = <1>; + des_bit = <3>; + index = <30>; + used = <0>; + timeout = <300>; + }; + }; + }; diff --git a/arch/arm64/configs/hikey970_defconfig b/arch/arm64/configs/hikey970_defconfig index e1eea7256faa..cb7f000b3b50 100755 --- a/arch/arm64/configs/hikey970_defconfig +++ b/arch/arm64/configs/hikey970_defconfig @@ -708,15 +708,15 @@ CONFIG_MALI_PLATFORM_HIKEY970=y CONFIG_MALI_MIDGARD=y CONFIG_MALI_EXPERT=y CONFIG_MALI_DEVFREQ=y -# CONFIG_HISILICON_PLATFORM is not set -# CONFIG_HISILICON_PLATFORM_MAILBOX is not set -# CONFIG_HISI_MAILBOX is not set -# CONFIG_HISI_RPROC is not set -# CONFIG_HIFI_DSP_ONE_TRACK is not set -# CONFIG_HIFI_MAILBOX is not set -# CONFIG_HIFI_IPC is not set -# CONFIG_HIFI_IPC_3660 is not set -# CONFIG_HIKEY970_HIFI is not set +CONFIG_HISILICON_PLATFORM=y +CONFIG_HISILICON_PLATFORM_MAILBOX=y +CONFIG_HISI_MAILBOX=y +CONFIG_HISI_RPROC=y +CONFIG_HIFI_DSP_ONE_TRACK=y +CONFIG_HIFI_MAILBOX=y +CONFIG_HIFI_IPC=y +CONFIG_HIFI_IPC_3660=y +CONFIG_HIKEY970_HIFI=y # CONFIG_HISI_ASP_DMA is not set # CONFIG_SND_I2S_HISI_I2S is not set # CONFIG_HDMI_ADV7511_AUDIO is not set diff --git a/drivers/hisi/hifi_dsp/Kconfig b/drivers/hisi/hifi_dsp/Kconfig old mode 100644 new mode 100755 index 987224a785f9..46a1be612b4b --- a/drivers/hisi/hifi_dsp/Kconfig +++ b/drivers/hisi/hifi_dsp/Kconfig @@ -4,5 +4,10 @@ config HIFI_DSP_ONE_TRACK bool "hifi low power play device support" help hifi lpp device provide service for HIFI and AP, in case of HIFI ultra-low power audio play. + +config HIKEY970_HIFI + bool "special memory mmap for hikey970" + help + special memory mmap for hikey970. endmenu diff --git a/drivers/hisi/hifi_dsp/hifi_lpp.h b/drivers/hisi/hifi_dsp/hifi_lpp.h old mode 100644 new mode 100755 index caea69d4c25e..e5e9999fd67e --- a/drivers/hisi/hifi_dsp/hifi_lpp.h +++ b/drivers/hisi/hifi_dsp/hifi_lpp.h @@ -25,8 +25,11 @@ extern "C" { #endif #include +#ifdef CONFIG_HIKEY970_HIFI +#include "../ap/platform/kirin970/global_ddr_map.h" +#else #include "../ap/platform/hi3660/global_ddr_map.h" - +#endif /* mailbox mail_len max */ #define MAIL_LEN_MAX (512) @@ -46,7 +49,11 @@ extern "C" { #define SIZE_LIMIT_PARAM (512) #endif +#ifdef CONFIG_HIKEY970_HIFI +#define NVPARAM_COUNT 600 //HIFI NV size is 600 +#else #define NVPARAM_COUNT 400 /*HIFI NV size is 400 */ +#endif #define NVPARAM_NUMBER 258 /*256+2, nv_data(256) + nv_id(2) */ #define NVPARAM_START 2 /*head protect_number 0x5a5a5a5a */ #define NVPARAM_TAIL 2 /*tail protect_number 0x5a5a5a5a */ @@ -77,21 +84,36 @@ extern "C" { /* |~~~~~~~6M~~~~~~~|~~~~~~192K~~~~~~|~~~~~208k~~~~~~|~~~~~~3.1M ~~~~~| */ /* |~~~0x897fffff~~~|~~~0x8982ffff~~~|~~~0x89863fff~~|~~~0x89B80000~~~| */ +#ifdef CONFIG_HIKEY970_HIFI +#define HIFI_UNSEC_REGION_SIZE (0x500000) +#define HIFI_MUSIC_DATA_SIZE (0x132000 + 0x32000) +#define PCM_PLAY_BUFF_SIZE (0x200000 - 0x32000) +#else #define HIFI_UNSEC_REGION_SIZE (0x380000) #define HIFI_MUSIC_DATA_SIZE (0x132000) #define PCM_PLAY_BUFF_SIZE (0x100000) +#endif #define DRV_DSP_UART_TO_MEM_SIZE (0x7f000) #define DRV_DSP_UART_TO_MEM_RESERVE_SIZE (0x100) #define DRV_DSP_STACK_TO_MEM_SIZE (0x1000) #define HIFI_ICC_DEBUG_SIZE (0x13000) #define HIFI_FLAG_DATA_SIZE (0x1000) #define HIFI_SEC_HEAD_SIZE (0x1000) +#ifdef CONFIG_HIKEY970_HIFI +#define HIFI_AP_NV_DATA_SIZE (0x4BC00) +#else #define HIFI_AP_NV_DATA_SIZE (0x32800) +#endif #define HIFI_AP_MAILBOX_TOTAL_SIZE (0x10000) #define CODEC_DSP_OM_DMA_BUFFER_SIZE (0xF000) #define CODEC_DSP_OM_DMA_CONFIG_SIZE (0x80) #define CODEC_DSP_SOUNDTRIGGER_TOTAL_SIZE (0xF000) #define HIFI_PCM_UPLOAD_BUFFER_SIZE (0x2000) + +#ifdef CONFIG_HIKEY970_HIFI +#define HIFI_PCM_UPLOAD_BUFFER_2_SHARE_MEM_OFFSET (0x4d800) +#endif + #define HIFI_HIKEY_SHARE_SIZE (0x1800 * 2) #define HIFI_UNSEC_RESERVE_SIZE (0x53780) @@ -108,7 +130,13 @@ extern "C" { #define CODEC_DSP_OM_DMA_CONFIG_ADDR (CODEC_DSP_OM_DMA_BUFFER_ADDR + CODEC_DSP_OM_DMA_BUFFER_SIZE) #define CODEC_DSP_SOUNDTRIGGER_BASE_ADDR (CODEC_DSP_OM_DMA_CONFIG_ADDR + CODEC_DSP_OM_DMA_CONFIG_SIZE) #define HIFI_PCM_UPLOAD_BUFFER_ADDR (CODEC_DSP_SOUNDTRIGGER_BASE_ADDR + CODEC_DSP_SOUNDTRIGGER_TOTAL_SIZE) + + +#ifdef CONFIG_HIKEY970_HIFI +#define HIFI_HIKEY_SHARE_MEM_ADDR (HIFI_PCM_UPLOAD_BUFFER_ADDR + HIFI_PCM_UPLOAD_BUFFER_SIZE + HIFI_PCM_UPLOAD_BUFFER_2_SHARE_MEM_OFFSET) +#else #define HIFI_HIKEY_SHARE_MEM_ADDR (HIFI_PCM_UPLOAD_BUFFER_ADDR + HIFI_AP_MAILBOX_TOTAL_SIZE) +#endif #define HIFI_UNSEC_RESERVE_ADDR (HIFI_HIKEY_SHARE_MEM_ADDR + HIFI_HIKEY_SHARE_SIZE) #if 0 #define HIFI_OM_LOG_SIZE (0xA000) @@ -143,10 +171,20 @@ extern "C" { #define DRV_DSP_FAMA_ON (0x1) #define DRV_DSP_FAMA_OFF (0x0) +#ifdef CONFIG_HIKEY970_HIFI +#define HIFI_SEC_REGION_SIZE (0xC00000) +#else #define HIFI_SEC_REGION_SIZE (0x980000) +#endif #define HIFI_IMAGE_OCRAMBAK_SIZE (0x30000) #ifdef HIFI_TCM_208K + +#ifdef CONFIG_HIKEY970_HIFI +#define HIFI_RUN_SIZE (0xB00000) +#else #define HIFI_RUN_SIZE (0x600000) +#endif + #define HIFI_IMAGE_TCMBAK_SIZE (0x34000) #define HIFI_IMAGE_SIZE (0x31C000) #define HIFI_RUN_ITCM_BASE (0xe8080000)