Initial commit: Linux kernel 4.19 for Unplugged OS

This commit is contained in:
ziv committed 2025-10-06 13:52:42 +00:00
commit d30235b04c
80519 files changed
+35800681

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
config MTK_SMI_EXT
bool "MediaTek SMI Platform Special Support"
select MEMORY
select MTK_SMI
help
This driver is for the memory controller module in MediaTek SoCs,
mainly help arbitrate memory bandwidth of multimedia,
and optimize multimedia memory usage in different scenarios.
If you are not sure about this, set y.
config MTK_SMI_VARIANT
bool "MTK SMI Tablet Code"
help
It's for smi common tablet framework,
it is used to arbitrate memory bandwidth of multimedia,
it can optimize multimedia memory usage in different scenarios,
and it will enable power-domain.
+107
View File
@@ -0,0 +1,107 @@
#
# Copyright (C) 2018 MediaTek Inc.
#
# 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
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
ifneq ($(CONFIG_MTK_SMI_VARIANT),y)
ifeq ($(CONFIG_MACH_MT6833),y)
SMI_PLATFORM := "mt6833"
else ifeq ($(CONFIG_MACH_MT6877),y)
SMI_PLATFORM := "mt6877"
else ifeq ($(CONFIG_MACH_MT6781),y)
SMI_PLATFORM := "mt6781"
else
SMI_PLATFORM := $(CONFIG_MTK_PLATFORM)
endif
ifeq ($(CONFIG_MTK_SMI_EXT), y)
ccflags-y += -I$(srctree)/drivers/clk/mediatek/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/cmdq/v3/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/cmdq/v3/$(SMI_PLATFORM)/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/cmdq/mailbox/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/emi/$(MTK_PLATFORM)/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/emi_bwl/$(MTK_PLATFORM)/
ccflags-$(CONFIG_MTK_IOMMU_V2) += -I$(srctree)/drivers/iommu/
ccflags-$(CONFIG_MTK_M4U) += -I$(srctree)/drivers/misc/mediatek/m4u/$(MTK_PLATFORM)/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/mmdvfs/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/smi/$(SMI_PLATFORM)/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/ # qos/$(MTK_PLATFORM)/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/dramc/$(MTK_PLATFORM)/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/mmp/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)/
ccflags-$(CONFIG_MTK_SMI_EXT) += -I$(srctree)/drivers/misc/mediatek/smi/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/freqhopping/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/freqhopping/$(CONFIG_MTK_PLATFORM)
ccflags-y += -I$(srctree)/drivers/gpu/mediatek/mt-plat
ifneq (,$(filter $(CONFIG_MTK_PLATFORM), "mt6739"))
ccflags-y += -DSMI_ZIO
ccflags-y += -DMMDVFS_HOOK
ccflags-y += -DVCORE_READY
ccflags-y += -I$(srctree)/drivers/clk/mediatek
obj-y += mmdvfs_mgr_v3.o
obj-y += mmdvfs_profile_adaptor.o
obj-y += mmdvfs_mgr_util.o
else ifneq (,$(filter $(CONFIG_MTK_PLATFORM), "mt6761"))
ccflags-y += -DSMI_MER
ccflags-y += -DMMDVFS_HOOK
ccflags-y += -DMMDVFS_QOS_SUPPORT
ccflags-y += -I$(srctree)/drivers/clk/mediatek
obj-y += mmdvfs_mgr_v3.o
obj-y += mmdvfs_profile_adaptor.o
obj-y += mmdvfs_mgr_util.o
else ifneq (,$(filter $(CONFIG_MTK_PLATFORM), "mt6771"))
ccflags-y += -DSMI_SYL
ccflags-y += -DDYNAMIC_DISP_HRT
ccflags-y += -DMMDVFS_HOOK
ccflags-y += -DVCORE_READY
ccflags-y += -DMMDVFS_QOS_SUPPORT
ccflags-y += -I$(srctree)/drivers/clk/mediatek
obj-y += mmdvfs_mgr_v3.o
obj-y += mmdvfs_profile_adaptor.o
obj-y += mmdvfs_mgr_util.o
SUPPORT_USE_DDR_TYPE := true
endif
ifeq (true, $(SUPPORT_USE_DDR_TYPE))
ccflags-y += -DUSE_DDR_TYPE
ccflags-y += -I$(srctree)/drivers/misc/mediatek/emi/$(MTK_PLATFORM)/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/emi/submodule/
endif
ifneq (,$(filter $(CONFIG_MTK_PLATFORM), "mt6873" "mt6885"))
ccflags-y += -DSMI_5G
endif
ifneq (,$(filter $(SMI_PLATFORM), "mt6873" "mt6885" "mt6853" "mt6833" "mt6877" "mt6781"))
ccflags-y += -DSMI_SSPM
ccflags-y += -DPMQOS_USE_IOMMU_PORT
ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm/v2/
else ifneq (,$(filter $(SMI_PLATFORM), "mt6768" "mt6785"))
ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm/v1/
else ifeq ($(CONFIG_MACH_MT6785),y)
ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm/v1/
else
ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm/
endif
ifneq (,$(filter $(CONFIG_MTK_PLATFORM), "mt6739" "mt6771"))
ccflags-y += -DSMI_CCF_NO_DUMP
endif
obj-y += smi_drv.o
endif
else
obj-y += $(subst ",,variant)/
endif
@@ -0,0 +1,274 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __MMDVFS_CONFIG_MT6739_H__
#define __MMDVFS_CONFIG_MT6739_H__
#include "mmdvfs_config_util.h"
#ifdef VCORE_READY
#include "mtk_vcorefs_manager.h"
#else
#define OPP_0 0
#define OPP_1 1
#define OPP_2 2
#define OPP_3 3
#endif
/* Part I MMSVFS HW Configuration (OPP)*/
/* Define the number of mmdvfs, vcore and mm clks opps */
#define MT6739_MMDVFS_OPP_MAX 4
#define MT6739_MMDVFS_CLK_OPP_MAX 4
#define MT6739_MMDVFS_VCORE_OPP_MAX 4
/* CLK source configuration */
/* CLK source IDs */
/* Define the internal index of each CLK source*/
#define MT6739_MMDVFS_CLK_TOP_SYSPLL2_D2 0
#define MT6739_MMDVFS_CLK_TOP_VENCPLL_CK 1
#define MT6739_CLK_SOURCE_NUM 2
/* CLK Source definiation */
/* Define the clk source description */
struct mmdvfs_clk_source_desc mt6739_clk_sources[MT6739_CLK_SOURCE_NUM] = {
{NULL, "mmdvfs_clk_top_syspll2_d2", 182},
{NULL, "mmdvfs_clk_top_vencpll_ck", 300},
};
/*
* B. CLK Change adaption configurtion
* B.1 Define the clk change method and data of each MM CLK step
* Field decscription:
* 1. config_method:
* a. MMDVFS_CLK_CONFIG_BY_MUX
* b. MMDVFS_CLK_CONFIG_PLL
* c. MMDVFS_CLK_CONFIG_NONE
* 2. pll_id: PLL ID, please set -1 if PLL hopping is not used
* 3. clk mux desc {hanlde, name}, plz set -1
* and it will be initialized by driver automaticlly
* 4. total step: the number of the steps supported by this sub sys
* 5. hopping dss of each steps: please set -1 if it is not used
* 6. clk sources id of each steps: please set -1 if it is not used
*/
struct mmdvfs_clk_hw_map mt6739_mmdvfs_clk_hw_map[MMDVFS_CLK_MUX_NUM] = {
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_MUX_TOP_SMI0_2X_SEL"}, -1, 2,
{-1, -1},
{-1, -1}
},
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_TOP_MMPLL_CK"}, -1, 2,
{-1, -1},
{MT6739_MMDVFS_CLK_TOP_VENCPLL_CK,
MT6739_MMDVFS_CLK_TOP_SYSPLL2_D2}
},
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_MUX_TOP_CAM_SEL"}, -1, 2,
{-1, -1},
{-1, -1}
},
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_MUX_TOP_IMG_SEL"}, -1, 2,
{-1, -1},
{-1, -1}
},
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_MUX_TOP_VENC_SEL"}, -1, 2,
{-1, -1},
{-1, -1}
},
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_MUX_TOP_VDEC_SEL"}, -1, 2,
{-1, -1},
{-1, -1}
},
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_MUX_TOP_MJC_SEL"}, -1, 2,
{-1, -1},
{-1, -1}
},
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_MUX_TOP_VPU_IF_SEL"}, -1, 2,
{-1, -1},
{-1, -1}
},
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_MUX_TOP_VPU_IF_SEL"}, -1, 2,
{-1, -1},
{-1, -1}
},
{ MMDVFS_CLK_CONFIG_NONE,
{ NULL, "MMDVFS_CLK_MUX_TOP_VPU_SEL"}, -1, 2,
{-1, -1},
{-1, -1}
}
};
/* Part II MMDVFS Scenario's Step Confuguration */
#define MT6739_MMDVFS_SENSOR_MIN (7900000)
/* A.1 [LP4 2-ch] Scenarios of each MM DVFS Step (force kicker) */
/* OPP 0 scenarios */
#define MT6739_MMDVFS_OPP0_NUM 11
struct mmdvfs_profile mt6739_mmdvfs_opp0_profiles[MT6739_MMDVFS_OPP0_NUM] = {
{"ICFP", SMI_BWC_SCEN_ICFP, {0, 0, 0}, {0, 0, 0 } },
{"Full Sensor Preview (ZSD)", SMI_BWC_SCEN_CAM_PV,
{MT6739_MMDVFS_SENSOR_MIN, 0, 0}, {0, 0, 0 } },
{"Full Sensor Capture (ZSD)", SMI_BWC_SCEN_CAM_CP,
{MT6739_MMDVFS_SENSOR_MIN, 0, 0}, {0, 0, 0 } },
{"Full Sensor Camera Recording", SMI_BWC_SCEN_VR,
{MT6739_MMDVFS_SENSOR_MIN, 0, 0}, {0, 0, 0 } },
{"VSS", SMI_BWC_SCEN_VSS,
{MT6739_MMDVFS_SENSOR_MIN, 0, 0}, {0, 0, 0 } },
{"PIP Feature Preview", SMI_BWC_SCEN_CAM_PV,
{0, MMDVFS_CAMERA_MODE_FLAG_PIP, 0}, {0, 0, 0 } },
{"PIP Feature Capture", SMI_BWC_SCEN_CAM_CP,
{0, MMDVFS_CAMERA_MODE_FLAG_PIP, 0}, {0, 0, 0 } },
{"PIP Feature Recording", SMI_BWC_SCEN_VR,
{0, MMDVFS_CAMERA_MODE_FLAG_PIP, 0}, {0, 0, 0 } },
{"FHD VR/ VSS (VENC)", SMI_BWC_SCEN_VENC,
{0, 0, 0}, {1920, 1080, 0} },
{"High resolution video playback", SMI_BWC_SCEN_VP_HIGH_RESOLUTION,
{0, 0, 0}, {0, 0, 0 } },
{"WFD", SMI_BWC_SCEN_WFD, {0, 0, 0}, {0, 0, 0 } },
};
/* OPP 1 scenarios */
#define MT6739_MMDVFS_OPP1_NUM 0
struct mmdvfs_profile mt6739_mmdvfs_opp1_profiles[MT6739_MMDVFS_OPP1_NUM] = {
};
/* OPP 2 scenarios */
#define MT6739_MMDVFS_OPP2_NUM 0
struct mmdvfs_profile mt6739_mmdvfs_opp2_profiles[MT6739_MMDVFS_OPP2_NUM] = {
};
/* OPP 3 scenarios */
#define MT6739_MMDVFS_OPP3_NUM 19
struct mmdvfs_profile mt6739_mmdvfs_opp3_profiles[MT6739_MMDVFS_OPP3_NUM] = {
{"SMVR", SMI_BWC_SCEN_VR_SLOW, {0, 0, 0}, {0, 0, 0 } },
{"EIS Feature Recording", SMI_BWC_SCEN_VR,
{0, MMDVFS_CAMERA_MODE_FLAG_EIS_2_0, 0}, {0, 0, 0 } },
{"Camera Preview", SMI_BWC_SCEN_CAM_PV, {0, 0, 0}, {0, 0, 0 } },
{"Camera Capture", SMI_BWC_SCEN_CAM_CP, {0, 0, 0}, {0, 0, 0 } },
{"Camera Recording", SMI_BWC_SCEN_VR, {0, 0, 0}, {0, 0, 0 } },
{"VSS", SMI_BWC_SCEN_VSS, {0, 0, 0}, {0, 0, 0 } },
{"VENC", SMI_BWC_SCEN_VENC, {0, 0, 0}, {0, 0, 0} },
{"MHL", MMDVFS_SCEN_MHL, {0, 0, 0}, {0, 0, 0 } },
{"High frame rate video playback", SMI_BWC_SCEN_VP_HIGH_FPS,
{0, 0, 0}, {0, 0, 0 } },
{"vFB Feature Preview", SMI_BWC_SCEN_CAM_PV,
{0, MMDVFS_CAMERA_MODE_FLAG_VFB, 0}, {0, 0, 0 } },
{"vFB Feature Capture", SMI_BWC_SCEN_CAM_CP,
{0, MMDVFS_CAMERA_MODE_FLAG_VFB, 0}, {0, 0, 0 } },
{"vFB Feature Recording", SMI_BWC_SCEN_VR,
{0, MMDVFS_CAMERA_MODE_FLAG_VFB, 0}, {0, 0, 0 } },
{"Stereo Feature Preview", SMI_BWC_SCEN_CAM_PV,
{0, MMDVFS_CAMERA_MODE_FLAG_STEREO, 0}, {0, 0, 0 } },
{"Stereo Feature Capture", SMI_BWC_SCEN_CAM_CP,
{0, MMDVFS_CAMERA_MODE_FLAG_STEREO, 0}, {0, 0, 0 } },
{"Stereo Feature Recording", SMI_BWC_SCEN_VR,
{0, MMDVFS_CAMERA_MODE_FLAG_STEREO, 0}, {0, 0, 0 } },
{"Dual zoom preview", SMI_BWC_SCEN_CAM_PV,
{0, MMDVFS_CAMERA_MODE_FLAG_DUAL_ZOOM, 0}, {0, 0, 0 } },
{"Dual zoom preview (reserved)", SMI_BWC_SCEN_CAM_CP,
{0, MMDVFS_CAMERA_MODE_FLAG_DUAL_ZOOM, 0}, {0, 0, 0 } },
{"Dual zoom preview (reserved)", SMI_BWC_SCEN_VR,
{0, MMDVFS_CAMERA_MODE_FLAG_DUAL_ZOOM, 0}, {0, 0, 0 } },
{"EIS 4K Feature Recording", SMI_BWC_SCEN_VR,
{MT6739_MMDVFS_SENSOR_MIN,
MMDVFS_CAMERA_MODE_FLAG_EIS_2_0, 0},
{0, 0, 0 } },
};
/* Defined the smi scenarios whose DVFS is controlled by low-level driver */
/* directly, not by BWC scenario change event */
#define MT6739_MMDVFS_SMI_USER_CONTROL_SCEN_MASK (1 << SMI_BWC_SCEN_VP)
/* Part III Scenario and MMSVFS HW configuration mapping */
/* 1. For a single mmdvfs step's profiles and hardware configuration */
struct mmdvfs_step_profile mt6739_step_profile[MT6739_MMDVFS_OPP_MAX] = {
{0, mt6739_mmdvfs_opp0_profiles, MT6739_MMDVFS_OPP0_NUM,
{OPP_0,
{MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0}, MMDVFS_CLK_MUX_NUM
}
},
{1, mt6739_mmdvfs_opp1_profiles, MT6739_MMDVFS_OPP1_NUM,
{OPP_1,
{MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1}, MMDVFS_CLK_MUX_NUM
}
},
{2, mt6739_mmdvfs_opp2_profiles, MT6739_MMDVFS_OPP2_NUM,
{OPP_2,
{MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1}, MMDVFS_CLK_MUX_NUM
}
},
{3, mt6739_mmdvfs_opp3_profiles, MT6739_MMDVFS_OPP3_NUM,
{OPP_3,
{MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1}, MMDVFS_CLK_MUX_NUM
}
},
};
/* Part III Scenario and MMSVFS HW configuration mapping */
#define MT6739_MMDVFS_VOLTAGE_LOW_OPP 3
#define MT6739_MMDVFS_VOLTAGE_HIGH_OPP 0
#define MT6739_MMDVFS_VOLTAGE_DEFAULT_STEP_OPP -1
#define MT6739_MMDVFS_VOLTAGE_LOW_LOW_OPP 3
int mt6739_mmdvfs_legacy_step_to_opp[MMDVFS_VOLTAGE_COUNT] = {
MT6739_MMDVFS_VOLTAGE_LOW_OPP,
MT6739_MMDVFS_VOLTAGE_HIGH_OPP,
MT6739_MMDVFS_VOLTAGE_DEFAULT_STEP_OPP,
MT6739_MMDVFS_VOLTAGE_LOW_LOW_OPP
};
#define MT6739_MMCLK_OPP0_LEGACY_STEP MMSYS_CLK_HIGH
#define MT6739_MMCLK_OPP1_LEGACY_STEP MMSYS_CLK_LOW
/* MMCLK_OPP3 and OPP2 is not used in this configuration */
#define MT6739_MMCLK_OPP2_LEGACY_STEP MMSYS_CLK_LOW
#define MT6739_MMCLK_OPP3_LEGACY_STEP MMSYS_CLK_LOW
int mt6739_mmdvfs_mmclk_opp_to_legacy_mmclk_step[MT6739_MMDVFS_OPP_MAX] = {
MT6739_MMCLK_OPP0_LEGACY_STEP, MT6739_MMCLK_OPP1_LEGACY_STEP,
MT6739_MMCLK_OPP2_LEGACY_STEP, MT6739_MMCLK_OPP3_LEGACY_STEP
};
/* Part IV VPU association */
/* There is no VPU DVFS in MT6739 */
/* Part V ISP DVFS configuration */
#define MMDVFS_ISP_THRESHOLD_NUM 2
int mt6739_mmdvs_isp_threshold_setting[MMDVFS_ISP_THRESHOLD_NUM] = {300, 182};
int mt6739_mmdvs_isp_threshold_opp[MMDVFS_ISP_THRESHOLD_NUM] = {
MMDVFS_FINE_STEP_OPP0, MMDVFS_FINE_STEP_OPP3};
struct mmdvfs_threshold_setting mt6739_mmdvfs_threshold[MMDVFS_PMQOS_NUM] = {
{ MMDVFS_PM_QOS_SUB_SYS_CAMERA, mt6739_mmdvs_isp_threshold_setting,
mt6739_mmdvs_isp_threshold_opp,
MMDVFS_ISP_THRESHOLD_NUM, MMDVFS_PMQOS_ISP},
};
#endif /* __MMDVFS_CONFIG_MT6739_H__ */
@@ -0,0 +1,112 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __MMDVFS_CONFIG_MT6761_H__
#define __MMDVFS_CONFIG_MT6761_H__
#include "mmdvfs_config_util.h"
/* Part I MMSVFS HW Configuration (OPP)*/
/* Define the number of mmdvfs, vcore and mm clks opps */
/* Max total MMDVFS opps of the profile support */
#define MT6761_MMDVFS_OPP_MAX 3
struct mmdvfs_profile_mask qos_apply_profiles[] = {
/* #ifdef MMDVFS_QOS_SUPPORT */
/* ISP for opp0 */
{"ISP",
SMI_BWC_SCEN_CAM_PV,
MMDVFS_FINE_STEP_OPP0},
{"ISP",
SMI_BWC_SCEN_CAM_CP,
MMDVFS_FINE_STEP_OPP0},
{"ISP",
SMI_BWC_SCEN_VR,
MMDVFS_FINE_STEP_OPP0},
/* ISP for opp1 */
{"ISP",
SMI_BWC_SCEN_CAM_PV,
MMDVFS_FINE_STEP_OPP1},
{"ISP",
SMI_BWC_SCEN_CAM_CP,
MMDVFS_FINE_STEP_OPP1},
{"ISP",
SMI_BWC_SCEN_VR,
MMDVFS_FINE_STEP_OPP1},
/* ISP for opp2 */
{"ISP",
SMI_BWC_SCEN_CAM_PV,
MMDVFS_FINE_STEP_OPP2},
{"ISP",
SMI_BWC_SCEN_CAM_CP,
MMDVFS_FINE_STEP_OPP2},
{"ISP",
SMI_BWC_SCEN_VR,
MMDVFS_FINE_STEP_OPP2},
/* ICFP for opp0 */
{"ICFP",
SMI_BWC_SCEN_ICFP,
MMDVFS_FINE_STEP_OPP0},
/* debug entry */
{"DEBUG",
0,
MMDVFS_FINE_STEP_UNREQUEST },
};
/* Part II MMDVFS Scenario's Step Confuguration */
#define MT6761_MMDVFS_SENSOR_MIN (13000000)
#define MT6761_MMDVFS_SENSOR_MID (16000000)
/* A.1 [LP4 2-ch] Scenarios of each MM DVFS Step (force kicker) */
/* OPP 0 scenarios */
#define MT6761_MMDVFS_OPP0_NUM 1
struct mmdvfs_profile mt6761_mmdvfs_opp0_profiles[MT6761_MMDVFS_OPP0_NUM] = {
{"ICFP", SMI_BWC_SCEN_ICFP, {0, 0, 0}, {0, 0, 0 } },
/*
* {"Camera Preview", SMI_BWC_SCEN_CAM_PV,
* {MT6761_MMDVFS_SENSOR_MID, 0, 0}, {0, 0, 0 } },
* {"Camera Capture", SMI_BWC_SCEN_CAM_CP,
* {MT6761_MMDVFS_SENSOR_MID, 0, 0}, {0, 0, 0 } },
* {"Video Recording", SMI_BWC_SCEN_VR,
* {MT6761_MMDVFS_SENSOR_MID, 0, 0}, {0, 0, 0 } },
*/
};
/* OPP 1 scenarios */
#define MT6761_MMDVFS_OPP1_NUM 0
struct mmdvfs_profile mt6761_mmdvfs_opp1_profiles[MT6761_MMDVFS_OPP1_NUM] = {
/*
* {"Camera Preview", SMI_BWC_SCEN_CAM_PV,
* {MT6761_MMDVFS_SENSOR_MIN, 0, 0}, {0, 0, 0 } },
* {"Camera Capture", SMI_BWC_SCEN_CAM_CP,
* {MT6761_MMDVFS_SENSOR_MIN, 0, 0}, {0, 0, 0 } },
* {"Video Recording", SMI_BWC_SCEN_VR,
* {MT6761_MMDVFS_SENSOR_MIN, 0, 0}, {0, 0, 0 } },
*/
};
/* OPP 2 scenarios */
#define MT6761_MMDVFS_OPP2_NUM 0
struct mmdvfs_profile mt6761_mmdvfs_opp2_profiles[MT6761_MMDVFS_OPP2_NUM] = {
/*
* {"Camera Preview", SMI_BWC_SCEN_CAM_PV, {0, 0, 0}, {0, 0, 0 } },
* {"Camera Capture", SMI_BWC_SCEN_CAM_CP, {0, 0, 0}, {0, 0, 0 } },
* {"Video Recording", SMI_BWC_SCEN_VR, {0, 0, 0}, {0, 0, 0 } },
*/
};
struct mmdvfs_step_to_qos_step legacy_to_qos_step[MT6761_MMDVFS_OPP_MAX] = {
{0, 0},
{1, 1},
{2, 2},
};
struct mmdvfs_step_profile mt6761_step_profile[MT6761_MMDVFS_OPP_MAX] = {
{0, mt6761_mmdvfs_opp0_profiles, MT6761_MMDVFS_OPP0_NUM, {0} },
{1, mt6761_mmdvfs_opp1_profiles, MT6761_MMDVFS_OPP1_NUM, {0} },
{2, mt6761_mmdvfs_opp2_profiles, MT6761_MMDVFS_OPP2_NUM, {0} },
};
#endif /* __MMDVFS_CONFIG_MT6761_H__ */
@@ -0,0 +1,349 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __MMDVFS_CONFIG_MT6765_H__
#define __MMDVFS_CONFIG_MT6765_H__
#include "mmdvfs_config_util.h"
#ifdef VCORE_READY
#include <mtk_vcorefs_manager.h>
#else
#define OPP_0 0
#define OPP_1 1
#define OPP_2 2
#define OPP_3 3
#endif
/* Part I MMSVFS HW Configuration (OPP)*/
/* Define the number of mmdvfs, vcore and mm clks opps */
/* Max total MMDVFS opps of the profile support */
#define MT6765_MMDVFS_OPP_MAX 5
/* Max total CLK opps of the profile support */
#define MT6765_MMDVFS_CLK_OPP_MAX 3
/* Max total Vcore opps of the profile support */
#define MT6765_MMDVFS_VCORE_OPP_MAX 4
/* CLK source configuration */
/* CLK source IDs */
/* Define the internal index of each CLK source*/
#define MT6765_CLK_TOP_MMPLL_CK 0
#define MT6765_CLK_TOP_UNIVPLL1_D2_CK 1
#define MT6765_CLK_TOP_MMPLL_D2_CK 2
#define MT6765_CLK_SOURCE_NUM 3
/* CLK Source definiation */
/* Define the clk source description */
struct mmdvfs_clk_source_desc mt6765_clk_sources[MT6765_CLK_SOURCE_NUM] = {
{NULL, "mmdvfs_clk_mmpll_ck", 457},
{NULL, "mmdvfs_clk_univpll1_d2_ck", 312},
{NULL, "mmdvfs_clk_mmpll_d2_ck", 228},
};
/*
* B. CLK Change adaption configurtion
* B.1 Define the clk change method and data of each MM CLK step
* Field decscription:
* 1. config_method:
* a. MMDVFS_CLK_CONFIG_BY_MUX
* b. MMDVFS_CLK_CONFIG_PLL
* c. MMDVFS_CLK_CONFIG_NONE
* 2. pll_id: PLL ID, please set -1 if PLL hopping is not used
* 3. clk mux desc {handle, name}, plz set -1
* and it will be initialized by driver automaticlly
* 4. total step: the number of the steps supported by this sub sys
* 5. hopping dss of each steps: please set -1 if it is not used
* 6. clk sources id of each steps: please set -1 if it is not used
*/
struct mmdvfs_clk_hw_map mt6765_clk_hw_map_setting[MMDVFS_CLK_MUX_NUM] = {
{MMDVFS_CLK_NONE,
{NULL, "MMDVFS_CLK_MUX_TOP_SMI0_2X_SEL"}, -1, 3,
{-1, -1, -1},
{-1, -1, -1}
},
{MMDVFS_CLK_BY_MUX,
{NULL, "MMDVFS_CLK_MUX_TOP_MM_SEL"}, -1, 3,
{-1, -1},
{MT6765_CLK_TOP_MMPLL_CK,
MT6765_CLK_TOP_UNIVPLL1_D2_CK,
MT6765_CLK_TOP_MMPLL_D2_CK}
},
{MMDVFS_CLK_NONE,
{NULL, "MMDVFS_CLK_MUX_TOP_CAM_SEL"}, -1, 3,
{-1, -1, -1},
{-1, -1, -1}
},
{MMDVFS_CLK_NONE,
{NULL, "MMDVFS_CLK_MUX_TOP_IMG_SEL"}, -1, 3,
{-1, -1, -1},
{-1, -1, -1}
},
{MMDVFS_CLK_NONE,
{NULL, "MMDVFS_CLK_MUX_TOP_VENC_SEL"}, -1, 3,
{-1, -1, -1},
{-1, -1, -1}
},
{MMDVFS_CLK_NONE,
{NULL, "MMDVFS_CLK_MUX_TOP_VDEC_SEL"}, -1, 3,
{-1, -1, -1},
{-1, -1, -1}
},
{MMDVFS_CLK_NONE,
{NULL, "MMDVFS_CLK_MUX_TOP_MJC_SEL"}, -1, 3,
{-1, -1, -1},
{-1, -1, -1}
},
{MMDVFS_CLK_NONE,
{NULL, "MMDVFS_CLK_MUX_TOP_VPU_IF_SEL"}, -1, 3,
{-1, -1, -1},
{-1, -1, -1}
},
{MMDVFS_CLK_NONE,
{NULL, "MMDVFS_CLK_MUX_TOP_VPU_IF_SEL"}, -1, 3,
{-1, -1, -1},
{-1, -1, -1}
},
{MMDVFS_CLK_NONE,
{NULL, "MMDVFS_CLK_MUX_TOP_VPU_SEL"}, -1, 3,
{-1, -1, -1},
{-1, -1, -1}
}
};
struct mmdvfs_profile_mask qos_apply_profiles[] = {
/* #ifdef MMDVFS_QOS_SUPPORT */
/* ISP for opp0 */
{"ISP",
MMDVFS_PMQOS_ISP,
MMDVFS_FINE_STEP_OPP0},
/* ISP for opp1 */
{"ISP",
MMDVFS_PMQOS_ISP,
MMDVFS_FINE_STEP_OPP2},
/* ISP for opp2 */
{"ISP",
MMDVFS_PMQOS_ISP,
MMDVFS_FINE_STEP_OPP4},
/* ICFP for opp0 */
{"ICFP",
SMI_BWC_SCEN_ICFP,
MMDVFS_FINE_STEP_OPP0},
/* ICFP for opp1 */
{"ICFP",
SMI_BWC_SCEN_ICFP,
MMDVFS_FINE_STEP_OPP1},
/* debug entry */
{"DEBUG",
0,
MMDVFS_FINE_STEP_UNREQUEST },
};
/* Part II MMDVFS Scenario's Step Confuguration */
#define MT6765_MMDVFS_SENSOR_MIN (16000000)
/* A.1 [LP4 2-ch] Scenarios of each MM DVFS Step (force kicker) */
/* OPP 0 scenarios */
#define MT6765_MMDVFS_OPP0_NUM 1
struct mmdvfs_profile mt6765_mmdvfs_opp0_profiles[MT6765_MMDVFS_OPP0_NUM] = {
{"ICFP", SMI_BWC_SCEN_ICFP, {0, 0, 0}, {0, 0, 0 } },
};
/* OPP 1 scenarios */
#define MT6765_MMDVFS_OPP1_NUM 0
struct mmdvfs_profile mt6765_mmdvfs_opp1_profiles[MT6765_MMDVFS_OPP1_NUM] = {
};
/* OPP 2 scenarios */
#define MT6765_MMDVFS_OPP2_NUM 0
struct mmdvfs_profile mt6765_mmdvfs_opp2_profiles[MT6765_MMDVFS_OPP2_NUM] = {
};
/* OPP 3 scenarios */
#define MT6765_MMDVFS_OPP3_NUM 0
struct mmdvfs_profile mt6765_mmdvfs_opp3_profiles[MT6765_MMDVFS_OPP3_NUM] = {
};
/* OPP 4 scenarios */
#define MT6765_MMDVFS_OPP4_NUM 0
struct mmdvfs_profile mt6765_mmdvfs_opp4_profiles[MT6765_MMDVFS_OPP4_NUM] = {
};
/* A.2 [LP3] Scenarios of each MM DVFS Step (force kicker) */
/* OPP 0 scenarios */
#define MT6765_LP3_MMDVFS_OPP0_NUM 1
struct mmdvfs_profile mt6765_mmdvfs_opp0_profiles_lp3[
MT6765_LP3_MMDVFS_OPP0_NUM] = {
{"ICFP", SMI_BWC_SCEN_ICFP, {0, 0, 0}, {0, 0, 0 } },
};
/* OPP 1 scenarios */
#define MT6765_LP3_MMDVFS_OPP1_NUM 0
struct mmdvfs_profile mt6765_mmdvfs_opp1_profiles_lp3[
MT6765_LP3_MMDVFS_OPP1_NUM] = {
};
/* OPP 2 scenarios */
#define MT6765_LP3_MMDVFS_OPP2_NUM 0
struct mmdvfs_profile mt6765_mmdvfs_opp2_profiles_lp3[
MT6765_LP3_MMDVFS_OPP2_NUM] = {
};
/* OPP 3 scenarios */
#define MT6765_LP3_MMDVFS_OPP3_NUM 0
struct mmdvfs_profile mt6765_mmdvfs_opp3_profiles_lp3[
MT6765_LP3_MMDVFS_OPP3_NUM] = {
};
/* OPP 4 scenarios */
#define MT6765_LP3_MMDVFS_OPP4_NUM 0
struct mmdvfs_profile mt6765_mmdvfs_opp4_profiles_lp3[
MT6765_LP3_MMDVFS_OPP4_NUM] = {
};
/* Defined the smi scenarios whose DVFS is controlled by low-level driver */
/* directly, not by BWC scenario change event */
#define MT6765_MMDVFS_USER_CONTROL_SCEN_MASK (1 << SMI_BWC_SCEN_VP)
struct mmdvfs_step_to_qos_step legacy_to_qos_step[MT6765_MMDVFS_OPP_MAX] = {
{0, 0},
{1, 0},
{2, 1},
{3, 1},
{4, 2},
};
/* Part III Scenario and MMSVFS HW configuration mapping */
/* 1. For a single mmdvfs step's profiles and hardware configuration */
/* LP4 2-ch */
struct mmdvfs_step_profile mt6765_step_profile[MT6765_MMDVFS_OPP_MAX] = {
{0, mt6765_mmdvfs_opp0_profiles, MT6765_MMDVFS_OPP0_NUM,
{OPP_0,
{MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0}, MMDVFS_CLK_MUX_NUM
}
},
{1, mt6765_mmdvfs_opp1_profiles, MT6765_MMDVFS_OPP1_NUM,
{OPP_0,
{MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0}, MMDVFS_CLK_MUX_NUM
}
},
{2, mt6765_mmdvfs_opp2_profiles, MT6765_MMDVFS_OPP2_NUM,
{OPP_1,
{MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1}, MMDVFS_CLK_MUX_NUM
}
},
{3, mt6765_mmdvfs_opp3_profiles, MT6765_MMDVFS_OPP3_NUM,
{OPP_1,
{MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1}, MMDVFS_CLK_MUX_NUM
}
},
{4, mt6765_mmdvfs_opp4_profiles, MT6765_MMDVFS_OPP4_NUM,
{OPP_3,
{MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2,
MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2,
MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2,
MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2,
MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2}, MMDVFS_CLK_MUX_NUM
}
},
};
/* LP3 */
struct mmdvfs_step_profile mt6765_step_profile_lp3[MT6765_MMDVFS_OPP_MAX] = {
{0, mt6765_mmdvfs_opp0_profiles_lp3, MT6765_LP3_MMDVFS_OPP0_NUM,
{OPP_0,
{MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0}, MMDVFS_CLK_MUX_NUM
}
},
{1, mt6765_mmdvfs_opp1_profiles_lp3, MT6765_LP3_MMDVFS_OPP1_NUM,
{OPP_0,
{MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0,
MMDVFS_MMCLK_OPP0, MMDVFS_MMCLK_OPP0}, MMDVFS_CLK_MUX_NUM
}
},
{2, mt6765_mmdvfs_opp2_profiles_lp3, MT6765_LP3_MMDVFS_OPP2_NUM,
{OPP_1,
{MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1}, MMDVFS_CLK_MUX_NUM
}
},
{3, mt6765_mmdvfs_opp3_profiles_lp3, MT6765_LP3_MMDVFS_OPP3_NUM,
{OPP_1,
{MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1,
MMDVFS_MMCLK_OPP1, MMDVFS_MMCLK_OPP1}, MMDVFS_CLK_MUX_NUM
}
},
{4, mt6765_mmdvfs_opp4_profiles_lp3, MT6765_LP3_MMDVFS_OPP4_NUM,
{OPP_3,
{MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2,
MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2,
MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2,
MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2,
MMDVFS_MMCLK_OPP2, MMDVFS_MMCLK_OPP2}, MMDVFS_CLK_MUX_NUM
}
},
};
/* Part III Scenario and MMSVFS HW configuration mapping */
/* Part IV VPU association */
/* There is no VPU DVFS in MT6765 */
/* Part V ISP DVFS configuration */
#define MMDVFS_ISP_THRESHOLD_NUM 3
int mt6765_isp_threshold_setting[MMDVFS_ISP_THRESHOLD_NUM] = {457, 312, 228};
int mt6765_isp_threshold_opp[MMDVFS_ISP_THRESHOLD_NUM] = {
MMDVFS_FINE_STEP_OPP0, MMDVFS_FINE_STEP_OPP2, MMDVFS_FINE_STEP_OPP4};
struct mmdvfs_thres_setting mt6765_thres_handler[MMDVFS_PM_QOS_SUB_SYS_NUM] = {
{ MMDVFS_PM_QOS_SUB_SYS_CAMERA, mt6765_isp_threshold_setting,
mt6765_isp_threshold_opp,
MMDVFS_ISP_THRESHOLD_NUM, MMDVFS_PMQOS_ISP},
};
#endif /* __MMDVFS_CONFIG_MT6765_H__ */
@@ -0,0 +1,259 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __MMDVFS_CONFIG_UTIL_H__
#define __MMDVFS_CONFIG_UTIL_H__
#include <linux/module.h>
//#include "mtk_smi.h"
#include "mmdvfs_mgr.h"
#define MMDVFS_CLK_CONFIG_BY_MUX (0)
#define MMDVFS_CLK_CONFIG_PLL_RATE (1)
#define MMDVFS_CLK_CONFIG_NONE (2)
/* System OPP number limitation (Max opp support)*/
#define MMDVFS_OPP_NUM_LIMITATION (6)
#define MMDVFS_CLK_OPP_NUM_LIMITATION (6)
#define MMDVFS_VCORE_OPP_NUM_LIMITATION (6)
/* MMDVFS OPPs (External interface, Vcore and MMCLK combined)*/
#define MMDVFS_FINE_STEP_UNREQUEST (-1)
#define MMDVFS_FINE_STEP_OPP0 (0)
#define MMDVFS_FINE_STEP_OPP1 (1)
#define MMDVFS_FINE_STEP_OPP2 (2)
#define MMDVFS_FINE_STEP_OPP3 (3)
#define MMDVFS_FINE_STEP_OPP4 (4)
#define MMDVFS_FINE_STEP_OPP5 (5)
/* MMCLK opps (internal used in MMDVFS) */
#define MMDVFS_MMCLK_OPP0 (0)
#define MMDVFS_MMCLK_OPP1 (1)
#define MMDVFS_MMCLK_OPP2 (2)
#define MMDVFS_MMCLK_OPP3 (3)
#define MMDVFS_MMCLK_OPP4 (4)
#define MMDVFS_MMCLK_OPP5 (5)
/* Defined the max size of MMDVFS CLK MUX table */
#define MMDVFS_CLK_MUX_NUM_LIMITATION (15)
/* CLK MUX ID */
/* Define the internal index of each MM CLK */
#define MMDVFS_CLK_MUX_TOP_SMI0_2X_SEL (0)
#define MMDVFS_CLK_MUX_TOP_MM_SEL (1)
#define MMDVFS_CLK_MUX_TOP_CAM_SEL (2)
#define MMDVFS_CLK_MUX_TOP_IMG_SEL (3)
#define MMDVFS_CLK_MUX_TOP_VENC_SEL (4)
#define MMDVFS_CLK_MUX_TOP_VDEC_SEL (5)
#define MMDVFS_CLK_MUX_TOP_MJC_SEL (6)
#define MMDVFS_CLK_MUX_TOP_DSP_SEL (7)
#define MMDVFS_CLK_MUX_TOP_VPU_IF_SEL (8)
#define MMDVFS_CLK_MUX_TOP_VPU_SEL (9)
#define MMDVFS_CLK_MUX_NUM (10)
/* VPU steps */
#define MMDVFS_VPU_OPP0 0
#define MMDVFS_VPU_OPP1 1
#define MMDVFS_VPU_OPP2 2
#define MMDVFS_VPU_OPP3 3
#define MMDVFS_VPU_OPP_NUM_LIMITATION 4
/* VPU internal clk steps*/
#define MMDVFS_VPU_INTERNAL_OPP0 0
#define MMDVFS_VPU_INTERNAL_OPP1 1
#define MMDVFS_VPU_INTERNAL_OPP2 2
#define MMDVFS_VPU_INTERNAL_OPP3 3
#define MMDVFS_VPU_INTERNAL_OPP_NUM 4
#define MMDVFS_VPU_INTERNAL_OPP_NUM_LIMITATION 4
/* Configuration Header */
struct mmdvfs_cam_property {
int sensor_size;
int feature_flag;
int fps;
int preview_size;
};
struct mmdvfs_video_property {
int width;
int height;
int codec;
};
struct mmdvfs_profile {
const char *profile_name;
int smi_scenario_id;
struct mmdvfs_cam_property cam_limit;
struct mmdvfs_video_property video_limit;
};
struct mmdvfs_profile_mask {
const char *profile_name;
int smi_scenario_id;
int mask_opp;
};
/* HW Configuration Management */
struct mmdvfs_clk_desc {
void *ccf_handle;
char *ccf_name; /* For debugging*/
};
struct mmdvfs_clk_source_desc {
void *ccf_handle;
char *ccf_name;
u32 clk_rate_mhz;
};
struct mmdvfs_clk_hw_map {
int config_method; /* 0: don't set, 1: clk_mux, 2: pll hopping */
struct mmdvfs_clk_desc clk_mux;
int pll_id;
int total_step;
/* DSS value of each step for this clk */
int step_pll_freq_map[MMDVFS_CLK_OPP_NUM_LIMITATION];
/* CLK MUX of each step for this clk */
int step_clk_source_id_map[MMDVFS_CLK_OPP_NUM_LIMITATION];
};
struct mmdvfs_hw_configurtion {
int vcore_step;
int clk_steps[MMDVFS_CLK_MUX_NUM_LIMITATION];
int total_clks;
};
struct mmdvfs_step_profile {
int mmdvfs_step;
struct mmdvfs_profile *profiles;
int total_profiles;
struct mmdvfs_hw_configurtion hw_config;
};
struct mmdvfs_step_to_qos_step {
int mmdvfs_step;
int qos_step;
};
/* For VPU DVFS configuration */
struct mmdvfs_vpu_steps_setting {
int vpu_dvfs_step;
char *vpu_dvfs_step_desc;
int mmdvfs_step; /* Associated mmdvfs step */
int vpu_clk_step;
int vpu_if_clk_step;
int vimvo_vol_step;
};
struct mmdvfs_adaptor {
int vcore_kicker;
int enable_vcore;
int enable_clk_mux;
int enable_pll_hopping;
struct mmdvfs_clk_source_desc *mmdvfs_clk_sources;
int mmdvfs_clk_sources_num;
struct mmdvfs_clk_hw_map *mmdvfs_clk_hw_maps;
int mmdvfs_clk_hw_maps_num;
struct mmdvfs_step_profile *step_profile_mappings;
int step_num;
int disable_auto_control_mask;
void (*profile_dump_func)(struct mmdvfs_adaptor *self);
void (*single_hw_configuration_dump_func)(
struct mmdvfs_adaptor *self,
struct mmdvfs_hw_configurtion *hw_configuration);
void (*hw_configuration_dump_func)(struct mmdvfs_adaptor *self);
int (*determine_mmdvfs_step)(struct mmdvfs_adaptor *self,
int smi_scenario, struct mmdvfs_cam_property *cam_setting,
struct mmdvfs_video_property *codec_setting);
int (*apply_hw_configurtion_by_step)(
struct mmdvfs_adaptor *self, int mmdvfs_step, int current_step);
int (*apply_vcore_hw_configurtion_by_step)(
struct mmdvfs_adaptor *self, int mmdvfs_step);
int (*apply_clk_hw_configurtion_by_step)(
struct mmdvfs_adaptor *self, int mmdvfs_step, bool to_high);
int (*get_cam_sys_clk)(struct mmdvfs_adaptor *self, int mmdvfs_step);
/* static members */
void (*single_profile_dump_func)(struct mmdvfs_profile *profile);
};
struct mmdvfs_step_util {
/* Record each scenaio's opp */
int mmdvfs_scenario_mmdvfs_opp[MMDVFS_SCEN_COUNT];
int total_scenario;
/* Record the currency status of each opps*/
int mmdvfs_concurrency_of_opps[MMDVFS_OPP_NUM_LIMITATION];
int total_opps;
int *mmclk_oop_to_legacy_step;
int mmclk_oop_to_legacy_step_num;
int *legacy_step_to_oop;
int legacy_step_to_oop_num;
int wfd_vp_mix_step;
void (*init)(struct mmdvfs_step_util *self);
int (*get_legacy_mmclk_step_from_mmclk_opp)(
struct mmdvfs_step_util *self, int mmclk_step);
int (*get_opp_from_legacy_step)(struct mmdvfs_step_util *self,
int legacy_step);
int (*set_step)(
struct mmdvfs_step_util *self, s32 step, u32 scenario);
int (*get_clients_clk_opp)(
struct mmdvfs_step_util *self, struct mmdvfs_adaptor *adaptor,
int clients_mask, int clk_id);
};
struct mmdvfs_vpu_dvfs_configurator {
int nr_vpu_steps;
int nr_vpu_clk_steps;
int nr_vpu_if_clk_steps;
int nr_vpu_vimvo_steps;
struct mmdvfs_vpu_steps_setting *mmdvfs_vpu_steps_settings;
const struct mmdvfs_vpu_steps_setting*
(*get_vpu_setting)(
struct mmdvfs_vpu_dvfs_configurator *self, int vpu_opp);
};
#define MMDVFS_PMQOS_NUM 1
#define MMDVFS_PM_QOS_SUB_SYS_CAMERA 0
struct mmdvfs_threshold_setting {
int class_id;
int *thresholds;
int *opps;
int thresholds_num;
int mmdvfs_client_id;
};
struct mmdvfs_thresholds_dvfs_handler {
struct mmdvfs_threshold_setting *threshold_settings;
int mmdvfs_threshold_setting_num;
int (*get_step)(struct mmdvfs_thresholds_dvfs_handler *self,
u32 class_id, u32 value);
};
extern struct mmdvfs_vpu_dvfs_configurator *g_mmdvfs_vpu_adaptor;
extern struct mmdvfs_adaptor *g_mmdvfs_adaptor;
extern struct mmdvfs_adaptor *g_mmdvfs_non_force_adaptor;
extern struct mmdvfs_step_util *g_mmdvfs_step_util;
extern struct mmdvfs_step_util *g_non_force_step_util;
extern struct mmdvfs_thresholds_dvfs_handler *g_dvfs_handler;
extern u32 camera_bw_config;
void mmdvfs_config_util_init(void);
#ifdef MMDVFS_QOS_SUPPORT
void mmdvfs_qos_update(struct mmdvfs_step_util *step_util, int new_step);
int set_qos_scenario(const char *val, const struct kernel_param *kp);
int get_qos_scenario(char *buf, const struct kernel_param *kp);
#endif
#endif /* __MMDVFS_CONFIG_UTIL_H__ */
@@ -0,0 +1,43 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __MMDVFS_INTERNAL_H__
#define __MMDVFS_INTERNAL_H__
#include "mmdvfs_mgr.h"
#define MMDVFS_LOG_TAG "MMDVFS"
#define MMDVFSMSG(string, args...) \
pr_notice("[pid=%d]"string, current->tgid, ##args)
#define MMDVFSDEBUG(level, x...) \
do { \
if (g_mmdvfs_debug_level \
&& (*g_mmdvfs_debug_level) >= (level)) \
MMDVFSMSG(x); \
} while (0)
#define MMDVFSMSG2(string, args...) pr_debug(string, ##args)
#define MMDVFSTMP(string, args...) \
pr_debug("[pid=%d]"string, current->tgid, ##args)
#define MMDVFSERR(string, args...) \
do {\
pr_notice("error: "string, ##args); \
aee_kernel_warning(MMDVFS_LOG_TAG, "error: "string, ##args); \
} while (0)
extern void mmdvfs_internal_handle_state_change(
struct mmdvfs_state_change_event *event);
extern void mmdvfs_internal_notify_vcore_calibration(
struct mmdvfs_prepare_action_event *event);
extern unsigned int *g_mmdvfs_debug_level;
extern unsigned int *g_mmdvfs_scen_log_mask;
extern int mmdvfs_internal_set_vpu_step(int current_step, int update_step);
extern void mmdvfs_internal_get_cam_setting(
struct mmdvfs_cam_property *cam_setting);
#endif /* __MMDVFS_INTERNAL_H__ */
+260
View File
@@ -0,0 +1,260 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __MMDVFS_MGR_H__
#define __MMDVFS_MGR_H__
#include <linux/plist.h>
#include <linux/of_address.h>
#include <aee.h>
#include "mtk_smi.h"
#define _BIT_(_bit_) (unsigned int)(1 << (_bit_))
#define _BITS_(_bits_, _val_) ((((unsigned int) -1 >> (31 - ((1) ? _bits_))) \
& ~((1U << ((0) ? _bits_)) - 1)) & ((_val_)<<((0) ? _bits_)))
#define _BITMASK_(_bits_) \
(((unsigned int) -1 >> (31 - ((1) ? _bits_))) & ~((1U << ((0) ? _bits_)) - 1))
#define _GET_BITS_VAL_(_bits_, _val_) \
(((_val_) & (_BITMASK_(_bits_))) >> ((0) ? _bits_))
/* MMDVFS extern APIs */
extern int set_mm_info_ioctl_wrapper(
struct file *pFile, unsigned int cmd, unsigned long param);
extern int get_mm_info_ioctl_wrapper(
struct file *pFile, unsigned int cmd, unsigned long param);
extern void mmdvfs_clks_init(struct device_node *of_node);
extern void mmdvfs_init(void);
extern void mmdvfs_handle_cmd(struct MTK_MMDVFS_CMD *cmd);
extern void mmdvfs_notify_scenario_enter(enum MTK_SMI_BWC_SCEN scen);
extern void mmdvfs_notify_scenario_exit(enum MTK_SMI_BWC_SCEN scen);
extern void mmdvfs_notify_scenario_concurrency(unsigned int u4Concurrency);
extern void mmdvfs_mhl_enable(int enable);
extern void mmdvfs_mjc_enable(int enable);
/* screen size */
extern unsigned int DISP_GetScreenWidth(void);
extern unsigned int DISP_GetScreenHeight(void);
#define MMDVFS_MMSYS_CLK_COUNT (3)
#define MMSYS_CLK_LOW (0)
#define MMSYS_CLK_HIGH (1)
#define MMSYS_CLK_MEDIUM (2)
#define MMDVFS_EVENT_OVL_SINGLE_LAYER_ENTER 0
#define MMDVFS_EVENT_OVL_SINGLE_LAYER_EXIT 1
#define MMDVFS_EVENT_UI_IDLE_ENTER 2
#define MMDVFS_EVENT_UI_IDLE_EXIT 3
#define MMDVFS_CLIENT_ID_ISP 0
#define QOS_ALL_SCENARIO 99
enum {
MMDVFS_CAM_MON_SCEN = SMI_BWC_SCEN_CNT,
MMDVFS_SCEN_MHL, MMDVFS_SCEN_MJC, MMDVFS_SCEN_DISP,
MMDVFS_SCEN_ISP, MMDVFS_SCEN_VP_HIGH_RESOLUTION,
MMDVFS_SCEN_VPU, MMDVFS_MGR,
MMDVFS_SCEN_VPU_KERNEL, MMDVFS_PMQOS_ISP,
MMDVFS_SCEN_VP_WFD, MMDVFS_SCEN_COUNT
};
#define LEGACY_CAM_SCENS ((1 << SMI_BWC_SCEN_VR) | \
(1 << SMI_BWC_SCEN_VR_SLOW) | \
(1 << SMI_BWC_SCEN_VSS) | \
(1 << SMI_BWC_SCEN_CAM_PV) | \
(1 << SMI_BWC_SCEN_CAM_CP) | \
(1 << SMI_BWC_SCEN_ICFP) | \
(1 << MMDVFS_SCEN_ISP))
enum mmdvfs_vpu_clk {
vpu_clk_0, vpu_clk_1, vpu_clk_2, vpu_clk_3
};
enum mmdvfs_vpu_if_clk {
vpu_if_clk_0, vpu_if_clk_1, vpu_if_clk_2, vpu_if_clk_3
};
enum mmdvfs_vimvo_vol {
vimvo_vol_0, vimvo_vol_1, vimvo_vol_2, vimvo_vol_3
};
struct mmdvfs_state_change_event {
int scenario;
int feature_flag;
int sensor_size;
int sensor_fps;
int vcore_vol_step;
int mmsys_clk_step;
int vpu_clk_step;
int vpu_if_clk_step;
int vimvo_vol_step;
};
struct mmdvfs_pm_qos_request {
struct plist_node node; /* reserved for QoS function */
int pm_qos_class;
struct delayed_work work; /* reserved for timeout handling */
};
#define MMDVFS_EVENT_PREPARE_CALIBRATION_START 0
#define MMDVFS_EVENT_PREPARE_CALIBRATION_END 1
struct mmdvfs_prepare_action_event {
int event_type;
};
typedef int (*clk_switch_cb)(
int ori_mmsys_clk_mode, int update_mmsys_clk_mode);
typedef int (*vdec_ctrl_cb)(void);
typedef int (*mmdvfs_state_change_cb)(
struct mmdvfs_state_change_event *event);
typedef int (*mmdvfs_prepare_action_cb)(
struct mmdvfs_prepare_action_event *event);
/* num: Display HRT capability drop times 100 */
/* ex: 150 => display HRT capability decrease 1.5 layer */
typedef int (*disp_hrt_change_cb)(int num);
/* MMDVFS V2 only APIs */
extern int mmdvfs_notify_mmclk_switch_request(int event);
extern int mmdvfs_raise_mmsys_by_mux(void);
extern int mmdvfs_lower_mmsys_by_mux(void);
extern int register_mmclk_switch_cb(clk_switch_cb notify_cb,
clk_switch_cb notify_cb_nolock);
extern int mmdvfs_register_mmclk_switch_cb(
clk_switch_cb notify_cb, int mmdvfs_client_id);
extern void dump_mmdvfs_info(void);
/* Extern from other module */
extern enum MTK_SMI_BWC_SCEN smi_get_current_profile(void);
extern int is_mmdvfs_freq_hopping_disabled(void);
extern int is_mmdvfs_freq_mux_disabled(void);
extern int is_force_max_mmsys_clk(void);
extern int is_force_camera_hpm(void);
extern int is_mmdvfs_disabled(void);
extern int force_always_on_mm_clks(void);
extern int mmdvfs_get_stable_isp_clk(void);
extern int get_mmdvfs_clk_mux_mask(void);
extern void mmdvfs_set_disp_hrt_cb(disp_hrt_change_cb change_cb);
extern void mmdvfs_set_md_on(bool to_on);
#ifdef MMDVFS_STANDALONE
#define vcorefs_request_dvfs_opp(scen, mode) do { \
MMDVFSMSG("vcorefs_request_dvfs_opp"); \
MMDVFSMSG("MMDVFS_STANDALONE mode enabled\n"); \
} while (0)
#define fliper_set_bw(BW_THRESHOLD_HIGH) do { \
MMDVFSMSG("MMDVFS_STANDALONE mode enabled\n"); \
MMDVFSMSG("fliper_set_bw");\
} while (0)
#define fliper_restore_bw() do {\
MMDVFSMSG("MMDVFS_STANDALONE mode enabled\n"); \
MMDVFSMSG("fliper_restore_bw(): fliper normal\n"); \
} while (0)
#endif /* MMDVFS_STANDALONE */
#ifdef MMDVFS_WQHD_1_0V
#include "disp_session.h"
extern int primary_display_switch_mode_for_mmdvfs(
int sess_mode, unsigned int session, int blocking);
#endif
/* D2 plus only */
/* extern void mt_set_vencpll_con1(int val); */
/* extern int clkmux_sel(int id, unsigned int clksrc, char *name); */
/* D1 plus implementation only */
/* extern u32 get_devinfo_with_index(u32 index); */
#define MMDVFS_PROFILE_UNKNOWN (0)
#define MMDVFS_PROFILE_R1 (1)
#define MMDVFS_PROFILE_J1 (2)
#define MMDVFS_PROFILE_D1 (3)
#define MMDVFS_PROFILE_D1_PLUS (4)
#define MMDVFS_PROFILE_D2 (5)
#define MMDVFS_PROFILE_D2_M_PLUS (6)
#define MMDVFS_PROFILE_D2_P_PLUS (7)
#define MMDVFS_PROFILE_D3 (8)
#define MMDVFS_PROFILE_E1 (9)
#define MMDVFS_PROFILE_WHY (10)
#define MMDVFS_PROFILE_WHY2 (11)
#define MMDVFS_PROFILE_ALA (12)
#define MMDVFS_PROFILE_BIA (13)
#define MMDVFS_PROFILE_VIN (14)
#define MMDVFS_PROFILE_ZIO (15)
#define MMDVFS_PROFILE_SYL (16)
#define MMDVFS_PROFILE_CAN (17)
#define MMDVFS_PROFILE_MER (18)
/* Macro used to resovling step setting ioctl command */
#define MMDVFS_IOCTL_CMD_STEP_FIELD_LEN (8)
#define MMDVFS_IOCTL_CMD_STEP_FIELD_MASK (0xFF)
#define MMDVFS_IOCTL_CMD_MMCLK_FIELD_MASK (0xFF00)
#define MMDVFS_IOCTL_CMD_DDR_TYPE_AUTO_SELECT (0xFF)
#define MMDVFS_IOCTL_CMD_VPU_STEP_UNREQUEST (0xFFFF)
/* Backward compatible */
#define SMI_BWC_SCEN_120HZ MMDVFS_SCEN_DISP
/* mmdvfs display sizes */
#define MMDVFS_DISPLAY_SIZE_HD (1280 * 832)
#define MMDVFS_DISPLAY_SIZE_FHD (1920 * 1216)
enum mmdvfs_lcd_size_enum {
MMDVFS_LCD_SIZE_HD, MMDVFS_LCD_SIZE_FHD,
MMDVFS_LCD_SIZE_WQHD, MMDVFS_LCD_SIZE_END_OF_ENUM
};
#ifndef CONFIG_MTK_SMI_EXT
#define mmdvfs_set_step(scenario, step)
#define mmdvfs_set_fine_step(scenario, step)
#else
int mmdvfs_set_step(enum MTK_SMI_BWC_SCEN scenario,
enum mmdvfs_voltage_enum step);
int mmdvfs_set_fine_step(enum MTK_SMI_BWC_SCEN smi_scenario,
int mmdvfs_fine_step);
#endif /* CONFIG_MTK_SMI_EXT */
extern int mmdvfs_get_mmdvfs_profile(void);
extern int is_mmdvfs_supported(void);
extern int mmdvfs_set_mmsys_clk(enum MTK_SMI_BWC_SCEN scenario,
int mmsys_clk_mode);
extern enum mmdvfs_lcd_size_enum mmdvfs_get_lcd_resolution(void);
extern int register_mmdvfs_state_change_cb(int mmdvfs_client_id,
mmdvfs_state_change_cb func);
extern void mmdvfs_notify_prepare_action(
struct mmdvfs_prepare_action_event *event);
extern int register_mmdvfs_prepare_cb(int mmdvfs_client_id,
mmdvfs_prepare_action_cb func);
/* The following interface can only used by mmdvfs itself for */
/* default step configuration */
extern void mmdvfs_default_step_set(int default_step);
extern void mmdvfs_default_start_delayed_setting(void);
extern void mmdvfs_default_stop_delayed_setting(void);
extern void mmdvfs_debug_set_mmdvfs_clks_enabled(int clk_enable_request);
extern int mmdvfs_get_current_fine_step(void);
extern void mmdvfs_pm_qos_update_request(struct mmdvfs_pm_qos_request *req,
u32 mmdvfs_pm_qos_class, u32 new_value);
extern void mmdvfs_pm_qos_remove_request(struct mmdvfs_pm_qos_request *req);
extern void mmdvfs_pm_qos_add_request(struct mmdvfs_pm_qos_request *req,
u32 mmdvfs_pm_qos_class, u32 value);
extern u32 mmdvfs_qos_get_thres_count(struct mmdvfs_pm_qos_request *req,
u32 mmdvfs_pm_qos_class);
extern u32 mmdvfs_qos_get_thres_value(struct mmdvfs_pm_qos_request *req,
u32 mmdvfs_pm_qos_class, u32 thres_idx);
extern u32 mmdvfs_qos_get_cur_thres(struct mmdvfs_pm_qos_request *req,
u32 mmdvfs_pm_qos_class);
#include "mmdvfs_config_util.h"
#endif /* __MMDVFS_MGR_H__ */
+107
View File
@@ -0,0 +1,107 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#include <linux/uaccess.h>
#include "mtk_smi.h"
#include "mmdvfs_mgr.h"
#include "mmdvfs_internal.h"
static mmdvfs_state_change_cb quick_change_cbs[MMDVFS_SCEN_COUNT];
static mmdvfs_prepare_action_cb quick_action_cbs[MMDVFS_SCEN_COUNT];
enum mmdvfs_lcd_size_enum mmdvfs_get_lcd_resolution(void)
{
enum mmdvfs_lcd_size_enum result = MMDVFS_LCD_SIZE_HD;
long lcd_resolution = 0;
long lcd_w = 0;
long lcd_h = 0;
int convert_err = -EINVAL;
#if defined(CONFIG_LCM_WIDTH) && defined(CONFIG_LCM_HEIGHT)
convert_err = kstrtoul(CONFIG_LCM_WIDTH, 10, &lcd_w);
if (!convert_err)
convert_err = kstrtoul(CONFIG_LCM_HEIGHT, 10, &lcd_h);
#endif /* CONFIG_LCM_WIDTH, CONFIG_LCM_HEIGHT */
if (convert_err) {
#if !defined(CONFIG_FPGA_EARLY_PORTING) && defined(CONFIG_MTK_FB)
lcd_w = DISP_GetScreenWidth();
lcd_h = DISP_GetScreenHeight();
#else
MMDVFSMSG("unable to get resolution\n");
#endif
}
lcd_resolution = lcd_w * lcd_h;
if (lcd_resolution <= MMDVFS_DISPLAY_SIZE_HD)
result = MMDVFS_LCD_SIZE_HD;
else if (lcd_resolution <= MMDVFS_DISPLAY_SIZE_FHD)
result = MMDVFS_LCD_SIZE_FHD;
else
result = MMDVFS_LCD_SIZE_WQHD;
return result;
}
int register_mmdvfs_prepare_cb(int mmdvfs_client_id,
mmdvfs_prepare_action_cb func)
{
if (mmdvfs_client_id >= 0 && mmdvfs_client_id < MMDVFS_SCEN_COUNT) {
MMDVFSMSG("prepare_cb registered: %d\n", mmdvfs_client_id);
quick_action_cbs[mmdvfs_client_id] = func;
} else {
MMDVFSMSG("clk_switch_cb failed: id=%d\n", mmdvfs_client_id);
return 1;
}
return 0;
}
void mmdvfs_notify_prepare_action(struct mmdvfs_prepare_action_event *event)
{
int i = 0;
mmdvfs_internal_notify_vcore_calibration(event);
MMDVFSMSG("prepare_action: %d\n", event->event_type);
for (i = 0; i < MMDVFS_SCEN_COUNT; i++) {
mmdvfs_prepare_action_cb func = quick_action_cbs[i];
if (func != NULL) {
MMDVFSMSG("prepare_action id:%d act:%d\n",
i, event->event_type);
func(event);
}
}
}
int register_mmdvfs_state_change_cb(int mmdvfs_client_id,
mmdvfs_state_change_cb func)
{
if (mmdvfs_client_id >= 0
&& mmdvfs_client_id < MMDVFS_SCEN_COUNT) {
quick_change_cbs[mmdvfs_client_id] = func;
} else {
MMDVFSMSG("clk_switch_cb failed id=%d\n",
mmdvfs_client_id);
return 1;
}
return 0;
}
void mmdvfs_internal_handle_state_change(
struct mmdvfs_state_change_event *event)
{
int i = 0;
for (i = 0; i < MMDVFS_SCEN_COUNT; i++) {
mmdvfs_state_change_cb func = quick_change_cbs[i];
if (func != NULL)
func(event);
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+178
View File
@@ -0,0 +1,178 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 3
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_ICFP 1
#define SMI_ESL_VR4K (SMI_ESL_ICFP)
#define SMI_ESL_WFD 2
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_WFD, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{0, 3}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{0, 0}, {0, 0}, {0, 0},
};
/* conf */
#define SMI_COMM_CONF_NUM 13
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_WRR_REG0, 0x6186186}, {SMI_WRR_REG1, 0x6186},
{SMI_Mx_RWULTRA_WRRy(1, 0, 0), 0x6186186},
{SMI_Mx_RWULTRA_WRRy(1, 0, 1), 0x6186},
{SMI_Mx_RWULTRA_WRRy(1, 1, 0), 0x6186186},
{SMI_Mx_RWULTRA_WRRy(1, 1, 1), 0x6186},
{SMI_Mx_RWULTRA_WRRy(2, 0, 0), 0x6186186},
{SMI_Mx_RWULTRA_WRRy(2, 0, 1), 0x6186},
{SMI_Mx_RWULTRA_WRRy(2, 1, 0), 0x6186186},
{SMI_Mx_RWULTRA_WRRy(2, 1, 1), 0x6186},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_LARB0_CONF_NUM 4
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_WRR_PORT(0), 0x5}, {SMI_LARB_WRR_PORT(1), 0x5},
{SMI_LARB_WRR_PORT(2), 0x5},
};
#define SMI_LARB1_CONF_NUM 1
struct mtk_smi_pair smi_larb1_conf_pair[SMI_LARB1_CONF_NUM] = {
{SMI_LARB_SW_FLAG, 0x1},
};
u32 smi_conf_pair_num[SMI_LARB_NUM + 1] = {
SMI_LARB0_CONF_NUM, SMI_LARB1_CONF_NUM, SMI_LARB1_CONF_NUM,
SMI_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_LARB_NUM + 1] = {
smi_larb0_conf_pair, smi_larb1_conf_pair, smi_larb1_conf_pair,
smi_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_comm_init_pair[SMI_LARB_NUM] = {
{SMI_L1ARB(0), 0x12f6}, {SMI_L1ARB(1), 0x1000}, {SMI_L1ARB(2), 0x1000},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1f}, {SMI_LARB_OSTDL_PORT(1), 0x1f},
{SMI_LARB_OSTDL_PORT(2), 0x1f}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x5},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x3}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x3},
{SMI_LARB_OSTDL_PORT(6), 0x2}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x5},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xc}, {SMI_LARB_OSTDL_PORT(1), 0x6},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2}, {SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x2}, {SMI_LARB_OSTDL_PORT(7), 0x2},
{SMI_LARB_OSTDL_PORT(8), 0x4}, {SMI_LARB_OSTDL_PORT(9), 0x3},
{SMI_LARB_OSTDL_PORT(10), 0x1},
};
/* scen: WFD */
struct mtk_smi_pair smi_larb0_wfd_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1}, {SMI_LARB_OSTDL_PORT(1), 0x1f},
{SMI_LARB_OSTDL_PORT(2), 0x1f}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x5},
};
/* {SMI_LARB_OSTDL_PORT(0), 0x1f}, */
/* scen: ICFP */
struct mtk_smi_pair smi_comm_icfp_pair[SMI_LARB_NUM] = {
{SMI_L1ARB(0), 0x119a}, {SMI_L1ARB(1), 0x118f}, {SMI_L1ARB(2), 0x1250},
};
struct mtk_smi_pair smi_larb0_icfp_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1f}, {SMI_LARB_OSTDL_PORT(1), 0x1f},
{SMI_LARB_OSTDL_PORT(2), 0x1f}, {SMI_LARB_OSTDL_PORT(3), 0xe},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x7},
};
/* {SMI_LARB_OSTDL_PORT(3), 0x2}, {SMI_LARB_OSTDL_PORT(6), 0x5}, */
struct mtk_smi_pair smi_larb1_icfp_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x4},
};
/* {SMI_LARB_OSTDL_PORT(0), 0x3}, {SMI_LARB_OSTDL_PORT(2), 0x2},
* {SMI_LARB_OSTDL_PORT(5), 0x3}, {SMI_LARB_OSTDL_PORT(6), 0x2},
* {SMI_LARB_OSTDL_PORT(10), 0x5},
*/
struct mtk_smi_pair smi_larb2_icfp_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xa}, {SMI_LARB_OSTDL_PORT(1), 0x4},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2}, {SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x2}, {SMI_LARB_OSTDL_PORT(7), 0x2},
{SMI_LARB_OSTDL_PORT(8), 0x4}, {SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x1},
};
/* {SMI_LARB_OSTDL_PORT(0), 0xc}, {SMI_LARB_OSTDL_PORT(1), 0x6},
* {SMI_LARB_OSTDL_PORT(9), 0x3},
*/
/* scen: ALL */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair, smi_comm_icfp_pair, smi_comm_icfp_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair, smi_larb0_icfp_pair, smi_larb0_wfd_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair, smi_larb1_icfp_pair, smi_larb1_icfp_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair, smi_larb2_icfp_pair, smi_larb2_icfp_pair,
};
u32 smi_scen_pair_num[SMI_LARB_NUM + 1] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_LARB_NUM + 1] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_comm_scen_pair,
};
#endif
+27
View File
@@ -0,0 +1,27 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6739-pg.h>
#include <smi_port.h>
#define SYS_DIS (SYS_MM0)
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_MM0] = ((1 << 0) | (1 << (SMI_LARB_NUM))),
[SYS_VEN] = (1 << 1),
[SYS_ISP] = (1 << 2),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_MM0] = "MM0", [SYS_VEN] = "VEN", [SYS_ISP] = "ISP",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,23 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#define SMI_OSTD_MAX (0x1f)
#define SMI_LARB_NUM (3)
#define SMI_LARB0_PORT_NUM (7) /* SYS_MM0 */
#define SMI_LARB1_PORT_NUM (11) /* SYS_VEN */
#define SMI_LARB2_PORT_NUM (11) /* SYS_ISP */
#define SMI_COMM_MASTER_NUM (SMI_LARB_NUM)
#define SMI_COMM_NUM (1)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 0, 0,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {0, 1, 2,};
#endif
+147
View File
@@ -0,0 +1,147 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 1
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_ICFP (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_VPWFD, SMI_ESL_VR4K, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{0, 5}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{0, 0}, {0, 0}, {0, 0},
};
/* conf */
#define SMI_COMM_CONF_NUM (7)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb},
{SMI_WRR_REG0, 0xc30c30c},
{SMI_Mx_RWULTRA_WRRy(1, 0, 0), 0x30c30c},
{SMI_Mx_RWULTRA_WRRy(1, 1, 0), 0x30c30c},
{SMI_Mx_RWULTRA_WRRy(2, 0, 0), 0x30c30c},
{SMI_Mx_RWULTRA_WRRy(2, 1, 0), 0x30c30c},
{SMI_DUMMY, 0x1},
};
#define SMI_LARB0_CONF_NUM (7)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370223}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_WRR_PORT(0), 0xb}, {SMI_LARB_WRR_PORT(1), 0xb},
{SMI_LARB_WRR_PORT(2), 0xb}, {SMI_LARB_WRR_PORT(3), 0xb},
{SMI_LARB_WRR_PORT(4), 0xb},
};
#define SMI_LARB1_CONF_NUM (2)
struct mtk_smi_pair smi_larb1_conf_pair[SMI_LARB1_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370223}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB2_CONF_NUM (2)
struct mtk_smi_pair smi_larb2_conf_pair[SMI_LARB2_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370223}, {SMI_LARB_SW_FLAG, 0x1},
};
u32 smi_conf_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_CONF_NUM, SMI_LARB1_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_DEV_NUM] = {
smi_larb0_conf_pair, smi_larb1_conf_pair, smi_larb2_conf_pair,
smi_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_BUS_SEL, 0x4},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1f}, {SMI_LARB_OSTDL_PORT(1), 0x1f},
{SMI_LARB_OSTDL_PORT(2), 0xe}, {SMI_LARB_OSTDL_PORT(3), 0x7},
{SMI_LARB_OSTDL_PORT(4), 0x7}, {SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x4}, {SMI_LARB_OSTDL_PORT(7), 0x1f},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x3}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x5},
{SMI_LARB_OSTDL_PORT(6), 0x3}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x6},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x16}, {SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2}, {SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x4}, {SMI_LARB_OSTDL_PORT(7), 0x2},
{SMI_LARB_OSTDL_PORT(8), 0x2}, {SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x2}, {SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4}, {SMI_LARB_OSTDL_PORT(13), 0x4},
{SMI_LARB_OSTDL_PORT(14), 0x4}, {SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4}, {SMI_LARB_OSTDL_PORT(17), 0x2},
{SMI_LARB_OSTDL_PORT(18), 0x2}, {SMI_LARB_OSTDL_PORT(19), 0x2},
{SMI_LARB_OSTDL_PORT(20), 0x2}, {SMI_LARB_OSTDL_PORT(21), 0x4},
{SMI_LARB_OSTDL_PORT(22), 0x4}, {SMI_LARB_OSTDL_PORT(23), 0x4},
};
/* scen: ALL */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair,
};
u32 smi_scen_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_COMM_MASTER_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_DEV_NUM] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_comm_scen_pair,
};
#endif
+30
View File
@@ -0,0 +1,30 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6761-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_DIS] = (1 << 0) | (1 << 3),
[SYS_CAM] = (1 << 2),
[SYS_VCODEC] = (1 << 1),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_DIS] = "DIS",
[SYS_CAM] = "CAM",
[SYS_VCODEC] = "VCODEC",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,28 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#include <dt-bindings/memory/mt6761-larb-port.h>
#define SMI_OSTD_MAX (0x3f)
#define SMI_COMM_MASTER_NUM (3)
#define SMI_LARB_NUM (3)
#define SMI_LARB0_PORT_NUM (8) /* SYS_DIS */
#define SMI_LARB1_PORT_NUM (11) /* SYS_VCODEC */
#define SMI_LARB2_PORT_NUM (24) /* SYS_CAM */
#define SMI_COMM_NUM (1)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
//#define SMI_LARB_CCU0 (13)
//#define SMI_LARB_CCU1 (14)
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 1,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 2};
static const u8
SMI_LARB_PORT_NUM[SMI_LARB_NUM] = {
8, 11, 24};
#endif
+209
View File
@@ -0,0 +1,209 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 2 /* init, icfp */
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
#define SMI_ESL_ICFP 1
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_VPWFD, SMI_ESL_VR4K, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{0, 5}, {0, 0}, {0, 0}, {0, 0}
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{4, SMI_LARB0_PORT_NUM}, {0, SMI_LARB1_PORT_NUM},
{0, SMI_LARB2_PORT_NUM}, {0, 0}
};
/* conf */
#define SMI_COMM_CONF_NUM (8)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_WRR_REG0, 0x30c30c}, {SMI_DCM, 0x4fd},
{SMI_Mx_RWULTRA_WRRy(1, 0, 0), 0x30c30c},
{SMI_Mx_RWULTRA_WRRy(1, 1, 0), 0x30c30c},
{SMI_Mx_RWULTRA_WRRy(2, 0, 0), 0x30c30c},
{SMI_Mx_RWULTRA_WRRy(2, 1, 0), 0x30c30c},
{SMI_DUMMY, 0x1},
};
#define SMI_LARB0_CONF_NUM (8)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370223},
{SMI_LARB_SW_FLAG, 0x1}, {SMI_LARB_SPM_ULTRA_MASK, 0xffffffc0},
{SMI_LARB_WRR_PORT(0), 0xb}, {SMI_LARB_WRR_PORT(1), 0xb},
{SMI_LARB_WRR_PORT(2), 0xb}, {SMI_LARB_WRR_PORT(3), 0xb},
{SMI_LARB_WRR_PORT(4), 0xb},
};
#define SMI_LARB1_CONF_NUM (2)
struct mtk_smi_pair smi_larb1_conf_pair[SMI_LARB1_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370223}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB2_CONF_NUM (3)
struct mtk_smi_pair smi_larb2_conf_pair[SMI_LARB2_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370223},
{SMI_LARB_SW_FLAG, 0x1}, {SMI_LARB_SPM_ULTRA_MASK, 0xffffc000},
};
#define SMI_LARB3_CONF_NUM (2)
struct mtk_smi_pair smi_larb3_conf_pair[SMI_LARB3_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370223}, {SMI_LARB_SW_FLAG, 0x1},
};
u32 smi_conf_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_CONF_NUM, SMI_LARB1_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB3_CONF_NUM, SMI_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_DEV_NUM] = {
smi_larb0_conf_pair, smi_larb1_conf_pair, smi_larb2_conf_pair,
smi_larb3_conf_pair, smi_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_comm_init_pair[SMI_COMM_MASTER_NUM + 1] = {
{SMI_L1ARB(0), 0x1ba5}, {SMI_L1ARB(1), 0x1000},
{SMI_L1ARB(2), 0x15d3}, {SMI_L1ARB(3), 0x1000},
{SMI_BUS_SEL, 0x4},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1f}, {SMI_LARB_OSTDL_PORT(1), 0x1f},
{SMI_LARB_OSTDL_PORT(2), 0x1f}, {SMI_LARB_OSTDL_PORT(3), 0x7},
{SMI_LARB_OSTDL_PORT(4), 0x7}, {SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x4}, {SMI_LARB_OSTDL_PORT(7), 0x1f},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x3}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x5},
{SMI_LARB_OSTDL_PORT(6), 0x3}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x6},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xc}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x4}, {SMI_LARB_OSTDL_PORT(3), 0x4},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1}, {SMI_LARB_OSTDL_PORT(11), 0x1},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x16}, {SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2}, {SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x4}, {SMI_LARB_OSTDL_PORT(7), 0x2},
{SMI_LARB_OSTDL_PORT(8), 0x2}, {SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x2}, {SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4}, {SMI_LARB_OSTDL_PORT(13), 0x4},
{SMI_LARB_OSTDL_PORT(14), 0x4}, {SMI_LARB_OSTDL_PORT(15), 0x2},
{SMI_LARB_OSTDL_PORT(16), 0x2}, {SMI_LARB_OSTDL_PORT(17), 0x2},
{SMI_LARB_OSTDL_PORT(18), 0x2}, {SMI_LARB_OSTDL_PORT(19), 0x2},
{SMI_LARB_OSTDL_PORT(20), 0x2},
};
/* scen: icfp */
struct mtk_smi_pair smi_comm_icfp_pair[SMI_COMM_MASTER_NUM + 1] = {
{SMI_L1ARB(0), 0x1327}, {SMI_L1ARB(1), 0x119e},
{SMI_L1ARB(2), 0x1241}, {SMI_L1ARB(3), 0x12e6},
{SMI_BUS_SEL, 0x44}
};
struct mtk_smi_pair smi_larb0_icfp_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1f}, {SMI_LARB_OSTDL_PORT(1), 0x1f},
{SMI_LARB_OSTDL_PORT(2), 0x1f}, {SMI_LARB_OSTDL_PORT(3), 0x7},
{SMI_LARB_OSTDL_PORT(4), 0x7}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0xb}, {SMI_LARB_OSTDL_PORT(7), 0x1f}
};
/* {mdp_wdma0(5), 0x4}, {mdp_wrot0(6), 0x4} */
struct mtk_smi_pair smi_larb1_icfp_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x3}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x5},
{SMI_LARB_OSTDL_PORT(6), 0x3}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x6}
};
struct mtk_smi_pair smi_larb2_icfp_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x6}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x3},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1}, {SMI_LARB_OSTDL_PORT(11), 0x1}
};
/* {imgi(0), 0xc}, {img3o(2), 0x4}, {vipi(3), 0x4} */
struct mtk_smi_pair smi_larb3_icfp_pair[SMI_LARB3_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x14}, {SMI_LARB_OSTDL_PORT(1), 0x6},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2}, {SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x4}, {SMI_LARB_OSTDL_PORT(7), 0x2},
{SMI_LARB_OSTDL_PORT(8), 0x2}, {SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x2}, {SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4}, {SMI_LARB_OSTDL_PORT(13), 0x4},
{SMI_LARB_OSTDL_PORT(14), 0x4}, {SMI_LARB_OSTDL_PORT(15), 0x2},
{SMI_LARB_OSTDL_PORT(16), 0x2}, {SMI_LARB_OSTDL_PORT(17), 0x2},
{SMI_LARB_OSTDL_PORT(18), 0x2}, {SMI_LARB_OSTDL_PORT(19), 0x2},
{SMI_LARB_OSTDL_PORT(20), 0x2}
};
/* scen: ALL */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair, smi_comm_icfp_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair, smi_larb0_icfp_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair, smi_larb1_icfp_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair, smi_larb2_icfp_pair,
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair, smi_larb3_icfp_pair,
};
u32 smi_scen_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_COMM_MASTER_NUM + 1,
};
struct mtk_smi_pair **smi_scen_pair[SMI_DEV_NUM] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_comm_scen_pair,
};
#endif
+32
View File
@@ -0,0 +1,32 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6765-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_DIS] = (1 << 0) | (1 << 4),
[SYS_CAM] = (1 << 3),
[SYS_VCODEC] = (1 << 1),
[SYS_ISP] = (1 << 2),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_DIS] = "DIS",
[SYS_CAM] = "CAM",
[SYS_VCODEC] = "VCODEC",
[SYS_ISP] = "ISP",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,86 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#define SMI_OSTD_MAX (0x3f)
#define SMI_COMM_MASTER_NUM (4)
#define SMI_LARB_NUM (4)
#define SMI_LARB0_PORT_NUM (8) /* MMSYS */
#define SMI_LARB1_PORT_NUM (11) /* VCODEC */
#define SMI_LARB2_PORT_NUM (12) /* IMGSYS */
#define SMI_LARB3_PORT_NUM (21) /* CAMSYS */
#define SMI_COMM_NUM (1)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 0, 1,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 2, 3};
static const u8
SMI_LARB_PORT_NUM[SMI_LARB_NUM] = {
8, 11, 12, 21};
#define SMI_LARB_PORT_ID(l, p) (((l) << 16) | ((p) & 0xffff))
#define SMI_DISP_OVL0 SMI_LARB_PORT_ID(0, 0)
#define SMI_DISP_OVL0_2L SMI_LARB_PORT_ID(0, 1)
#define SMI_DISP_RDMA0 SMI_LARB_PORT_ID(0, 2)
#define SMI_DISP_WDMA0 SMI_LARB_PORT_ID(0, 3)
#define SMI_DISP_MDP_RDMA0 SMI_LARB_PORT_ID(0, 4)
#define SMI_DISP_MDP_WDMA0 SMI_LARB_PORT_ID(0, 5)
#define SMI_DISP_MDP_WROT0 SMI_LARB_PORT_ID(0, 6)
#define SMI_DISP_FAKE0 SMI_LARB_PORT_ID(0, 7)
#define SMI_VENC_RCPU SMI_LARB_PORT_ID(1, 0)
#define SMI_VENC_REC SMI_LARB_PORT_ID(1, 1)
#define SMI_VENC_BSDMA SMI_LARB_PORT_ID(1, 2)
#define SMI_VENC_SV_COMV SMI_LARB_PORT_ID(1, 3)
#define SMI_VENC_RD_COMV SMI_LARB_PORT_ID(1, 4)
#define SMI_JPGENC_RDMA SMI_LARB_PORT_ID(1, 5)
#define SMI_JPGENC_BSDMA SMI_LARB_PORT_ID(1, 6)
#define SMI_VENC_CUR_LUMA SMI_LARB_PORT_ID(1, 7)
#define SMI_VENC_CUR_CHROMA SMI_LARB_PORT_ID(1, 8)
#define SMI_VENC_REF_LUMA SMI_LARB_PORT_ID(1, 9)
#define SMI_VENC_REF_CHROMA SMI_LARB_PORT_ID(1, 10)
#define SMI_CAM_IMGI SMI_LARB_PORT_ID(2, 0)
#define SMI_CAM_IMG2O SMI_LARB_PORT_ID(2, 1)
#define SMI_CAM_IMG3O SMI_LARB_PORT_ID(2, 2)
#define SMI_CAM_VIPI SMI_LARB_PORT_ID(2, 3)
#define SMI_CAM_LCEI SMI_LARB_PORT_ID(2, 4)
#define SMI_CAM_FD_RP SMI_LARB_PORT_ID(2, 5)
#define SMI_CAM_FD_WR SMI_LARB_PORT_ID(2, 6)
#define SMI_CAM_FD_RD SMI_LARB_PORT_ID(2, 7)
#define SMI_CAM_DPE_RDMA SMI_LARB_PORT_ID(2, 8)
#define SMI_CAM_DPE_WDMA SMI_LARB_PORT_ID(2, 9)
#define SMI_CAM_RSC_RDMA SMI_LARB_PORT_ID(2, 10)
#define SMI_CAM_RSC_WDMA SMI_LARB_PORT_ID(2, 11)
#define SMI_CAM_IMGO SMI_LARB_PORT_ID(3, 0)
#define SMI_CAM_RRZO SMI_LARB_PORT_ID(3, 1)
#define SMI_CAM_AAO SMI_LARB_PORT_ID(3, 2)
#define SMI_CAM_AFO SMI_LARB_PORT_ID(3, 3)
#define SMI_CAM_LSCI0 SMI_LARB_PORT_ID(3, 4)
#define SMI_CAM_LSCI1 SMI_LARB_PORT_ID(3, 5)
#define SMI_CAM_PDO SMI_LARB_PORT_ID(3, 6)
#define SMI_CAM_BPCI SMI_LARB_PORT_ID(3, 7)
#define SMI_CAM_LSCO SMI_LARB_PORT_ID(3, 8)
#define SMI_CAM_RSSO_A SMI_LARB_PORT_ID(3, 9)
#define SMI_CAM_RSSO_B SMI_LARB_PORT_ID(3, 10)
#define SMI_CAM_UFEO SMI_LARB_PORT_ID(3, 11)
#define SMI_CAM_SOC0 SMI_LARB_PORT_ID(3, 12)
#define SMI_CAM_SOC1 SMI_LARB_PORT_ID(3, 13)
#define SMI_CAM_SOC2 SMI_LARB_PORT_ID(3, 14)
#define SMI_CAM_CCUI SMI_LARB_PORT_ID(3, 15)
#define SMI_CAM_CCUO SMI_LARB_PORT_ID(3, 16)
#define SMI_CAM_CACI SMI_LARB_PORT_ID(3, 17)
#define SMI_CAM_RAWI_A SMI_LARB_PORT_ID(3, 18)
#define SMI_CAM_RAWI_B SMI_LARB_PORT_ID(3, 19)
#define SMI_CAM_CCUG SMI_LARB_PORT_ID(3, 20)
#endif
+230
View File
@@ -0,0 +1,230 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM (2)
#define SMI_ESL_INIT (0)
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
#define SMI_ESL_ICFP (1)
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{0, 5}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{4, SMI_LARB0_PORT_NUM}, {0, SMI_LARB1_PORT_NUM},
{0, SMI_LARB2_PORT_NUM}, {0, 0}, {0, SMI_LARB4_PORT_NUM},
};
/* conf */
#define SMI_LARB0_CONF_NUM (8)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370223}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_SPM_ULTRA_MASK, 0xffffffc0},
{SMI_LARB_WRR_PORT(0), 0xb}, {SMI_LARB_WRR_PORT(1), 0xb},
{SMI_LARB_WRR_PORT(2), 0xb}, {SMI_LARB_WRR_PORT(3), 0xb},
{SMI_LARB_WRR_PORT(4), 0xb},
};
#define SMI_LARB1_CONF_NUM (2)
struct mtk_smi_pair smi_larb1_conf_pair[SMI_LARB1_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300223}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB2_CONF_NUM (3)
struct mtk_smi_pair smi_larb2_conf_pair[SMI_LARB2_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300223}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_SPM_ULTRA_MASK, 0xffffc000},
};
#define SMI_LARB3_CONF_NUM (2)
struct mtk_smi_pair smi_larb3_conf_pair[SMI_LARB3_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370223}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_COMM_CONF_NUM (8)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_WRR_REG0, 0x30c30c}, {SMI_DCM, 0x4fd},
{SMI_Mx_RWULTRA_WRRy(1, 0, 0), 0x30c30c},
{SMI_Mx_RWULTRA_WRRy(1, 1, 0), 0x30c30c},
{SMI_Mx_RWULTRA_WRRy(2, 0, 0), 0x30c30c},
{SMI_Mx_RWULTRA_WRRy(2, 1, 0), 0x30c30c},
{SMI_DUMMY, 0x1}
};
u32 smi_conf_pair_num[SMI_LARB_NUM + 1] = {
SMI_LARB0_CONF_NUM, SMI_LARB1_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB3_CONF_NUM, SMI_LARB3_CONF_NUM,
SMI_COMM_CONF_NUM
};
struct mtk_smi_pair *smi_conf_pair[SMI_LARB_NUM + 1] = {
smi_larb0_conf_pair, smi_larb1_conf_pair, smi_larb2_conf_pair,
smi_larb1_conf_pair, smi_larb1_conf_pair,
smi_comm_conf_pair
};
/* scen: INIT */
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1f}, {SMI_LARB_OSTDL_PORT(1), 0x1f},
{SMI_LARB_OSTDL_PORT(2), 0x1f}, {SMI_LARB_OSTDL_PORT(3), 0x7},
{SMI_LARB_OSTDL_PORT(4), 0x7}, {SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x4}, {SMI_LARB_OSTDL_PORT(7), 0x1f},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x9}, {SMI_LARB_OSTDL_PORT(1), 0x9},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x6},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xc}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x4}, {SMI_LARB_OSTDL_PORT(3), 0x4},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1}, {SMI_LARB_OSTDL_PORT(11), 0x1},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x16}, {SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2}, {SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x4}, {SMI_LARB_OSTDL_PORT(7), 0x2},
{SMI_LARB_OSTDL_PORT(8), 0x2}, {SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x2}, {SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4}, {SMI_LARB_OSTDL_PORT(13), 0x4},
{SMI_LARB_OSTDL_PORT(14), 0x4}, {SMI_LARB_OSTDL_PORT(15), 0x2},
{SMI_LARB_OSTDL_PORT(16), 0x2}, {SMI_LARB_OSTDL_PORT(17), 0x2},
{SMI_LARB_OSTDL_PORT(18), 0x2}, {SMI_LARB_OSTDL_PORT(19), 0x2},
{SMI_LARB_OSTDL_PORT(20), 0x2},
};
struct mtk_smi_pair smi_larb4_init_pair[SMI_LARB4_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x3}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x5},
{SMI_LARB_OSTDL_PORT(6), 0x3}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x6},
};
struct mtk_smi_pair smi_comm_init_pair[SMI_LARB_NUM + 1] = {
{SMI_L1ARB(0), 0x1ba5}, {SMI_L1ARB(1), 0x1000}, {SMI_L1ARB(2), 0x15d3},
{SMI_L1ARB(3), 0x1000}, {SMI_L1ARB(4), 0x1000}, {SMI_BUS_SEL, 0x104},
};
/* scen: ICFP */
struct mtk_smi_pair smi_larb0_icfp_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1f}, {SMI_LARB_OSTDL_PORT(1), 0x1f},
{SMI_LARB_OSTDL_PORT(2), 0x1f}, {SMI_LARB_OSTDL_PORT(3), 0x7},
{SMI_LARB_OSTDL_PORT(4), 0x7}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0xb}, {SMI_LARB_OSTDL_PORT(7), 0x1f},
};
/* {mdp_wdma0(5), 0x4}, {mdp_wrot0(6), 0x4} */
struct mtk_smi_pair smi_larb1_icfp_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x3}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x6},
};
struct mtk_smi_pair smi_larb2_icfp_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x6}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x3},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1}, {SMI_LARB_OSTDL_PORT(11), 0x1},
};
/* {imgi(0), 0xc}, {img3o(2), 0x4}, {vipi(3), 0x4} */
struct mtk_smi_pair smi_larb3_icfp_pair[SMI_LARB3_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x14}, {SMI_LARB_OSTDL_PORT(1), 0x6},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2}, {SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x4}, {SMI_LARB_OSTDL_PORT(7), 0x2},
{SMI_LARB_OSTDL_PORT(8), 0x2}, {SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x2}, {SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4}, {SMI_LARB_OSTDL_PORT(13), 0x4},
{SMI_LARB_OSTDL_PORT(14), 0x4}, {SMI_LARB_OSTDL_PORT(15), 0x2},
{SMI_LARB_OSTDL_PORT(16), 0x2}, {SMI_LARB_OSTDL_PORT(17), 0x2},
{SMI_LARB_OSTDL_PORT(18), 0x2}, {SMI_LARB_OSTDL_PORT(19), 0x2},
{SMI_LARB_OSTDL_PORT(20), 0x2},
};
/* {imgo(0), 0x16}, {rrzo(1), 0x14} */
struct mtk_smi_pair smi_larb4_icfp_pair[SMI_LARB4_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x3}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x5},
{SMI_LARB_OSTDL_PORT(6), 0x3}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x6},
};
struct mtk_smi_pair smi_comm_icfp_pair[SMI_LARB_NUM + 1] = {
{SMI_L1ARB(0), 0x1327}, {SMI_L1ARB(1), 0x119e}, {SMI_L1ARB(2), 0x1241},
{SMI_L1ARB(3), 0x12e6}, {SMI_L1ARB(1), 0x119e}, {SMI_BUS_SEL, 0x144},
};
/* scen: ALL */
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair, smi_larb0_icfp_pair
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair, smi_larb1_icfp_pair
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair, smi_larb2_icfp_pair
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair, smi_larb3_icfp_pair
};
struct mtk_smi_pair *smi_larb4_scen_pair[SMI_SCEN_NUM] = {
smi_larb4_init_pair, smi_larb4_icfp_pair
};
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair, smi_comm_icfp_pair
};
u32 smi_scen_pair_num[SMI_LARB_NUM + 1] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_LARB4_PORT_NUM,
(SMI_LARB_NUM + 1)
};
struct mtk_smi_pair **smi_scen_pair[SMI_LARB_NUM + 1] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_larb4_scen_pair, smi_comm_scen_pair
};
#endif
+29
View File
@@ -0,0 +1,29 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6768-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_DIS] = ((1 << 0) | (1 << (SMI_LARB_NUM))),
[SYS_VDEC] = (1 << 1),
[SYS_ISP] = (1 << 2),
[SYS_CAM] = (1 << 3),
[SYS_VENC] = (1 << 4),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile_function.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_DIS] = "DIS", [SYS_VDEC] = "VDE",
[SYS_ISP] = "ISP", [SYS_CAM] = "CAM", [SYS_VENC] = "VEN",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,25 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#define SMI_OSTD_MAX (0x1f)
#define SMI_LARB_NUM (5)
#define SMI_LARB0_PORT_NUM (8) /* SYS_DIS */
#define SMI_LARB1_PORT_NUM (9) /* SYS_VDE */
#define SMI_LARB2_PORT_NUM (12) /* SYS_ISP */
#define SMI_LARB3_PORT_NUM (21) /* SYS_CAM */
#define SMI_LARB4_PORT_NUM (11) /* SYS_VEN */
#define SMI_COMM_MASTER_NUM (SMI_LARB_NUM)
#define SMI_COMM_NUM (1)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 0, 0, 1,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {0, 1, 2, 3, 4,};
#endif
+301
View File
@@ -0,0 +1,301 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 1 /* init */
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
#define SMI_ESL_ICFP (SMI_ESL_INIT)
static unsigned int smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_VPWFD, SMI_ESL_VR4K, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static unsigned int smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}
};
static unsigned int smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{0, 0}, {5, SMI_LARB1_PORT_NUM}, {0, SMI_LARB2_PORT_NUM},
{0, SMI_LARB3_PORT_NUM}, {0, 0}, {0, SMI_LARB5_PORT_NUM},
{0, SMI_LARB6_PORT_NUM}, {0, SMI_LARB7_PORT_NUM},
{0, SMI_LARB8_PORT_NUM}, {0, 0}, {0, 0}, {0, SMI_LARB11_PORT_NUM},
};
/* conf */
#define SMI_COMM_CONF_NUM (7)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_M4U_TH, 0xe100e10}, {SMI_FIFO_TH1, 0x506090a},
{SMI_FIFO_TH2, 0x506090a}, {SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
{SMI_BUS_SEL, 0x5514},
};
#define SMI_LARB0_CONF_NUM (11)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_WRR_PORT(0), 0xb}, {SMI_LARB_WRR_PORT(1), 0xb},
{SMI_LARB_WRR_PORT(2), 0xb}, {SMI_LARB_WRR_PORT(3), 0x5},
{SMI_LARB_WRR_PORT(4), 0x5}, {SMI_LARB_WRR_PORT(5), 0xb},
{SMI_LARB_WRR_PORT(6), 0xb}, {SMI_LARB_WRR_PORT(7), 0xb},
{SMI_LARB_WRR_PORT(8), 0xb},
};
#define SMI_LARB1_CONF_NUM (16)
struct mtk_smi_pair smi_larb1_conf_pair[SMI_LARB1_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_WRR_PORT(0), 0xb}, {SMI_LARB_WRR_PORT(1), 0xb},
{SMI_LARB_WRR_PORT(2), 0x5}, {SMI_LARB_WRR_PORT(3), 0x5},
{SMI_LARB_WRR_PORT(4), 0xb}, {SMI_LARB_WRR_PORT(5), 0x1},
{SMI_LARB_WRR_PORT(6), 0x1}, {SMI_LARB_WRR_PORT(7), 0x1},
{SMI_LARB_WRR_PORT(8), 0x1}, {SMI_LARB_WRR_PORT(9), 0x1},
{SMI_LARB_WRR_PORT(10), 0x1}, {SMI_LARB_WRR_PORT(11), 0x1},
{SMI_LARB_WRR_PORT(12), 0x1}, {SMI_LARB_WRR_PORT(13), 0x4},
};
/* DISABLE CMD_THRT RD_EN */
#define SMI_LARB2_CONF_NUM (2)
struct mtk_smi_pair smi_larb2_conf_pair[SMI_LARB2_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB5_CONF_NUM (8)
struct mtk_smi_pair smi_larb5_conf_pair[SMI_LARB5_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_WRR_PORT(0), 0xb}, {SMI_LARB_WRR_PORT(1), 0xb},
{SMI_LARB_WRR_PORT(2), 0xb}, {SMI_LARB_WRR_PORT(3), 0xb},
{SMI_LARB_WRR_PORT(4), 0xb}, {SMI_LARB_WRR_PORT(5), 0xb},
};
/* LARB6, LARB11 */
#define SMI_LARB6_CONF_NUM (2)
struct mtk_smi_pair smi_larb6_conf_pair[SMI_LARB6_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
};
u32 smi_conf_pair_num[SMI_LARB_NUM + 1] = {
SMI_LARB0_CONF_NUM, SMI_LARB1_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB5_CONF_NUM,
SMI_LARB6_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB6_CONF_NUM,
SMI_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_LARB_NUM + 1] = {
smi_larb0_conf_pair, smi_larb1_conf_pair, smi_larb2_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb5_conf_pair,
smi_larb6_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb6_conf_pair,
smi_comm_conf_pair
};
/* scen: init */
struct mtk_smi_pair smi_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28}, {SMI_LARB_OSTDL_PORT(1), 0x28},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x28},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0xA}, {SMI_LARB_OSTDL_PORT(7), 0xA},
{SMI_LARB_OSTDL_PORT(8), 0x28},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x28}, {SMI_LARB_OSTDL_PORT(3), 0x28},
{SMI_LARB_OSTDL_PORT(4), 0xA}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0xD},
{SMI_LARB_OSTDL_PORT(8), 0xD}, {SMI_LARB_OSTDL_PORT(9), 0x7},
{SMI_LARB_OSTDL_PORT(10), 0x1}, {SMI_LARB_OSTDL_PORT(11), 0x7},
{SMI_LARB_OSTDL_PORT(12), 0x1}, {SMI_LARB_OSTDL_PORT(13), 0x28},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x18}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x8}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x1}, {SMI_LARB_OSTDL_PORT(11), 0x1},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1}, {SMI_LARB_OSTDL_PORT(1), 0x3},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x4},
{SMI_LARB_OSTDL_PORT(8), 0x2}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x4}, {SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x1}, {SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x1}, {SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0xB}, {SMI_LARB_OSTDL_PORT(17), 0x13},
{SMI_LARB_OSTDL_PORT(18), 0x14},
};
struct mtk_smi_pair smi_larb4_init_pair[SMI_LARB4_PORT_NUM] = {};
struct mtk_smi_pair smi_larb5_init_pair[SMI_LARB5_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x13}, {SMI_LARB_OSTDL_PORT(1), 0xF},
{SMI_LARB_OSTDL_PORT(2), 0xD}, {SMI_LARB_OSTDL_PORT(3), 0x7},
{SMI_LARB_OSTDL_PORT(4), 0x7}, {SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x3}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x3}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x5}, {SMI_LARB_OSTDL_PORT(11), 0xC},
{SMI_LARB_OSTDL_PORT(12), 0x1}, {SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x8}, {SMI_LARB_OSTDL_PORT(15), 0x6},
{SMI_LARB_OSTDL_PORT(16), 0x2}, {SMI_LARB_OSTDL_PORT(17), 0x1},
{SMI_LARB_OSTDL_PORT(18), 0x8}, {SMI_LARB_OSTDL_PORT(19), 0x8},
{SMI_LARB_OSTDL_PORT(20), 0x1}, {SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x1}, {SMI_LARB_OSTDL_PORT(23), 0x1},
{SMI_LARB_OSTDL_PORT(24), 0x1}, {SMI_LARB_OSTDL_PORT(25), 0x1},
};
struct mtk_smi_pair smi_larb6_init_pair[SMI_LARB6_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
};
struct mtk_smi_pair smi_larb7_init_pair[SMI_LARB7_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
};
struct mtk_smi_pair smi_larb8_init_pair[SMI_LARB8_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x1},
};
struct mtk_smi_pair smi_larb9_init_pair[SMI_LARB9_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1F}, {SMI_LARB_OSTDL_PORT(1), 0x1A},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x4},
{SMI_LARB_OSTDL_PORT(4), 0x1F}, {SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x14}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1F}, {SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4}, {SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x1}, {SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x2}, {SMI_LARB_OSTDL_PORT(15), 0x2},
{SMI_LARB_OSTDL_PORT(16), 0x4}, {SMI_LARB_OSTDL_PORT(17), 0x2},
{SMI_LARB_OSTDL_PORT(18), 0x1}, {SMI_LARB_OSTDL_PORT(19), 0x2},
{SMI_LARB_OSTDL_PORT(20), 0x4}, {SMI_LARB_OSTDL_PORT(21), 0x2},
{SMI_LARB_OSTDL_PORT(22), 0x2}, {SMI_LARB_OSTDL_PORT(23), 0x1},
};
struct mtk_smi_pair smi_larb10_init_pair[SMI_LARB10_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1F}, {SMI_LARB_OSTDL_PORT(1), 0x1A},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x4},
{SMI_LARB_OSTDL_PORT(4), 0x1F}, {SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x14}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1F}, {SMI_LARB_OSTDL_PORT(9), 0x1A},
{SMI_LARB_OSTDL_PORT(10), 0x2}, {SMI_LARB_OSTDL_PORT(11), 0x4},
{SMI_LARB_OSTDL_PORT(12), 0x1F}, {SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x14}, {SMI_LARB_OSTDL_PORT(15), 0x1},
{SMI_LARB_OSTDL_PORT(16), 0x1}, {SMI_LARB_OSTDL_PORT(17), 0x2},
{SMI_LARB_OSTDL_PORT(18), 0x2}, {SMI_LARB_OSTDL_PORT(19), 0x4},
{SMI_LARB_OSTDL_PORT(20), 0x2}, {SMI_LARB_OSTDL_PORT(21), 0xA},
{SMI_LARB_OSTDL_PORT(22), 0x2}, {SMI_LARB_OSTDL_PORT(23), 0x2},
{SMI_LARB_OSTDL_PORT(24), 0x4}, {SMI_LARB_OSTDL_PORT(25), 0x2},
{SMI_LARB_OSTDL_PORT(26), 0xA}, {SMI_LARB_OSTDL_PORT(27), 0x2},
{SMI_LARB_OSTDL_PORT(28), 0x4}, {SMI_LARB_OSTDL_PORT(29), 0x2},
{SMI_LARB_OSTDL_PORT(30), 0x4},
};
struct mtk_smi_pair smi_larb11_init_pair[SMI_LARB11_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
};
/* scen: all */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair,
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair,
};
struct mtk_smi_pair *smi_larb4_scen_pair[SMI_SCEN_NUM] = {
smi_larb4_init_pair,
};
struct mtk_smi_pair *smi_larb5_scen_pair[SMI_SCEN_NUM] = {
smi_larb5_init_pair,
};
struct mtk_smi_pair *smi_larb6_scen_pair[SMI_SCEN_NUM] = {
smi_larb6_init_pair,
};
struct mtk_smi_pair *smi_larb7_scen_pair[SMI_SCEN_NUM] = {
smi_larb7_init_pair,
};
struct mtk_smi_pair *smi_larb8_scen_pair[SMI_SCEN_NUM] = {
smi_larb8_init_pair,
};
struct mtk_smi_pair *smi_larb9_scen_pair[SMI_SCEN_NUM] = {
smi_larb9_init_pair,
};
struct mtk_smi_pair *smi_larb10_scen_pair[SMI_SCEN_NUM] = {
smi_larb10_init_pair,
};
struct mtk_smi_pair *smi_larb11_scen_pair[SMI_SCEN_NUM] = {
smi_larb11_init_pair,
};
u32 smi_scen_pair_num[SMI_LARB_NUM + 1] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_LARB4_PORT_NUM, SMI_LARB5_PORT_NUM,
SMI_LARB6_PORT_NUM, SMI_LARB7_PORT_NUM, SMI_LARB8_PORT_NUM,
SMI_LARB9_PORT_NUM, SMI_LARB10_PORT_NUM, SMI_LARB11_PORT_NUM,
SMI_COMM_MASTER_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_LARB_NUM + 1] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_larb4_scen_pair, smi_larb5_scen_pair,
smi_larb6_scen_pair, smi_larb7_scen_pair, smi_larb8_scen_pair,
smi_larb9_scen_pair, smi_larb10_scen_pair, smi_larb11_scen_pair,
smi_comm_scen_pair,
};
#endif
+37
View File
@@ -0,0 +1,37 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6779-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_DIS] = (1 << 0) | (1 << 1) | (1 << 12),
[SYS_VDE] = (1 << 2),
[SYS_VEN] = (1 << 3),
[SYS_ISP] = (1 << 5) | (1 << 6),
[SYS_IPE] = (1 << 7) | (1 << 8),
[SYS_CAM] = (1 << 9) | (1 << 10) | (1 << 11),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_DIS] = "DIS",
[SYS_VDE] = "VDE",
[SYS_VEN] = "VEN",
[SYS_ISP] = "ISP",
[SYS_IPE] = "IPE",
[SYS_CAM] = "CAM",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
+171
View File
@@ -0,0 +1,171 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#define SMI_OSTD_MAX (0x3f)
#define SMI_COMM_MASTER_NUM (1 << 3)
#define SMI_LARB_NUM 12
#define SMI_LARB0_PORT_NUM 9 /* DIS */
#define SMI_LARB1_PORT_NUM 14 /* DIS */
#define SMI_LARB2_PORT_NUM 12 /* VDE */
#define SMI_LARB3_PORT_NUM 19 /* VEN */
#define SMI_LARB4_PORT_NUM 0 /* DUMMY */
#define SMI_LARB5_PORT_NUM 26 /* ISP */
#define SMI_LARB6_PORT_NUM 3 /* IPU */
#define SMI_LARB7_PORT_NUM 4 /* IPE */
#define SMI_LARB8_PORT_NUM 10 /* IPE */
#define SMI_LARB9_PORT_NUM 24 /* CAM */
#define SMI_LARB10_PORT_NUM 31 /* CAM */
#define SMI_LARB11_PORT_NUM 5 /* IPU */
#define SMI_COMM_NUM (1)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 1, 0, 1, 1, 1, 1};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 2, 3, SMI_COMM_MASTER_NUM, 4,
SMI_COMM_MASTER_NUM, 5, 5, 7, 6, SMI_COMM_MASTER_NUM};
static const u8
SMI_LARB_PORT_NUM[SMI_LARB_NUM] = {
9, 14, 12, 19, 0, 26, 3, 4, 10, 24, 31, 5};
#define SMI_LARB_PORT_ID(l, p) (((l) << 16) | ((p) & 0xffff))
/* MMSYS */
#define SMI_PORT_DISP_POSTMASK0 SMI_LARB_PORT_ID(0, 0)
#define SMI_PORT_DISP_OVL0_HDR SMI_LARB_PORT_ID(0, 1)
#define SMI_PORT_DISP_OVL0 SMI_LARB_PORT_ID(0, 3)
#define SMI_PORT_DISP_RDMA0 SMI_LARB_PORT_ID(0, 6)
#define SMI_PORT_DISP_WDMA0 SMI_LARB_PORT_ID(0, 7)
#define SMI_PORT_DISP_OVL0_2L_HDR SMI_LARB_PORT_ID(1, 0)
#define SMI_PORT_DISP_OVL0_2L SMI_LARB_PORT_ID(1, 2)
#define SMI_PORT_DISP_OVL1_2L SMI_LARB_PORT_ID(1, 3)
#define SMI_PORT_DISP_RDMA1 SMI_LARB_PORT_ID(1, 4)
#define SMI_PORT_MDP_RDMA0 SMI_LARB_PORT_ID(1, 7)
#define SMI_PORT_MDP_RDMA1 SMI_LARB_PORT_ID(1, 8)
#define SMI_PORT_MDP_WROT0_R SMI_LARB_PORT_ID(1, 9)
#define SMI_PORT_MDP_WROT1_R SMI_LARB_PORT_ID(1, 11)
/* VDEC */
#define SMI_PORT_VDEC_MC SMI_LARB_PORT_ID(2, 0)
#define SMI_PORT_VDEC_UFO SMI_LARB_PORT_ID(2, 1)
#define SMI_PORT_VDEC_PP SMI_LARB_PORT_ID(2, 2)
#define SMI_PORT_VDEC_PRED_RD SMI_LARB_PORT_ID(2, 3)
#define SMI_PORT_VDEC_PRED_WR SMI_LARB_PORT_ID(2, 4)
#define SMI_PORT_VDEC_PPWRAP SMI_LARB_PORT_ID(2, 5)
#define SMI_PORT_VDEC_TILE SMI_LARB_PORT_ID(2, 6)
#define SMI_PORT_VDEC_VLD SMI_LARB_PORT_ID(2, 7)
#define SMI_PORT_VDEC_VLD2 SMI_LARB_PORT_ID(2, 8)
#define SMI_PORT_VDEC_AVC_MV SMI_LARB_PORT_ID(2, 9)
#define SMI_PORT_VDEC_UFO_ENC SMI_LARB_PORT_ID(2, 10)
#define SMI_PORT_VDEC_RG_CTRL_DMA SMI_LARB_PORT_ID(2, 11)
/* VENC */
#define SMI_PORT_VENC_RCPU SMI_LARB_PORT_ID(3, 0)
#define SMI_PORT_VENC_REC SMI_LARB_PORT_ID(3, 1)
#define SMI_PORT_VENC_BSDMA SMI_LARB_PORT_ID(3, 2)
#define SMI_PORT_VENC_SV_COMV SMI_LARB_PORT_ID(3, 3)
#define SMI_PORT_VENC_RD_COMV SMI_LARB_PORT_ID(3, 4)
#define SMI_PORT_JPGENC_Y_RDMA SMI_LARB_PORT_ID(3, 7)
#define SMI_PORT_JPGENC_C_RDMA SMI_LARB_PORT_ID(3, 8)
#define SMI_PORT_JPGENC_Q_TABLE SMI_LARB_PORT_ID(3, 9)
#define SMI_PORT_JPGENC_BSDMA SMI_LARB_PORT_ID(3, 10)
#define SMI_PORT_VENC_CUR_LUMA SMI_LARB_PORT_ID(3, 15)
#define SMI_PORT_VENC_CUR_CHROMA SMI_LARB_PORT_ID(3, 16)
#define SMI_PORT_VENC_REF_LUMA SMI_LARB_PORT_ID(3, 17)
#define SMI_PORT_VENC_REF_CHROMA SMI_LARB_PORT_ID(3, 18)
/* IMG */
#define SMI_PORT_IMGI_D1 SMI_LARB_PORT_ID(5, 0)
#define SMI_PORT_IMGCI_D1 SMI_LARB_PORT_ID(5, 1)
#define SMI_PORT_DMGI_D1 SMI_LARB_PORT_ID(5, 2)
#define SMI_PORT_UFDI_D1 SMI_LARB_PORT_ID(5, 3)
#define SMI_PORT_LCI_D1 SMI_LARB_PORT_ID(5, 4)
#define SMI_PORT_SMTI_D1 SMI_LARB_PORT_ID(5, 5)
#define SMI_PORT_SMTO_D2 SMI_LARB_PORT_ID(5, 6)
#define SMI_PORT_SMTO_D1 SMI_LARB_PORT_ID(5, 7)
#define SMI_PORT_CRZO_D1 SMI_LARB_PORT_ID(5, 8)
#define SMI_PORT_UFOYW SMI_LARB_PORT_ID(5, 9)
#define SMI_PORT_UFOCW SMI_LARB_PORT_ID(5, 10)
#define SMI_PORT_UFOYR SMI_LARB_PORT_ID(5, 11)
#define SMI_PORT_UFOCR SMI_LARB_PORT_ID(5, 12)
#define SMI_PORT_UFOY2R SMI_LARB_PORT_ID(5, 13)
#define SMI_PORT_UFOC2R SMI_LARB_PORT_ID(5, 14)
#define SMI_PORT_WPE_RDMA1 SMI_LARB_PORT_ID(5, 15)
#define SMI_PORT_WPR_RDMA0 SMI_LARB_PORT_ID(5, 16)
#define SMI_PORT_WPR_WDMA SMI_LARB_PORT_ID(5, 17)
#define SMI_PORT_TIMGO_D1 SMI_LARB_PORT_ID(5, 18)
#define SMI_PORT_PRVYR SMI_LARB_PORT_ID(5, 19)
/* IPE */
#define SMI_PORT_FDVT_RDA SMI_LARB_PORT_ID(8, 0)
#define SMI_PORT_FDVT_RDB SMI_LARB_PORT_ID(8, 1)
#define SMI_PORT_FDVT_WRA SMI_LARB_PORT_ID(8, 2)
#define SMI_PORT_FDVT_WRB SMI_LARB_PORT_ID(8, 3)
#define SMI_PORT_RSC_RDMA0 SMI_LARB_PORT_ID(8, 8)
#define SMI_PORT_RSC_WDMA SMI_LARB_PORT_ID(8, 9)
/* CAM */
#define SMI_PORT_IMGO_R1_C SMI_LARB_PORT_ID(9, 0)
#define SMI_PORT_RRZO_R1_C SMI_LARB_PORT_ID(9, 1)
#define SMI_PORT_LSCI_R1_C SMI_LARB_PORT_ID(9, 2)
#define SMI_PORT_BPCI_R1_C SMI_LARB_PORT_ID(9, 3)
#define SMI_PORT_YUVO_R1_C SMI_LARB_PORT_ID(9, 4)
#define SMI_PORT_UFDI_R2_C SMI_LARB_PORT_ID(9, 5)
#define SMI_PORT_RAWI_R2_C SMI_LARB_PORT_ID(9, 6)
#define SMI_PORT_CAMSV_1 SMI_LARB_PORT_ID(9, 8)
#define SMI_PORT_CAMSV_2 SMI_LARB_PORT_ID(9, 9)
#define SMI_PORT_CAMSV_3 SMI_LARB_PORT_ID(9, 10)
#define SMI_PORT_AAO_R1_C SMI_LARB_PORT_ID(9, 14)
#define SMI_PORT_AFO_R1_C SMI_LARB_PORT_ID(9, 15)
#define SMI_PORT_FLKO_R1_C SMI_LARB_PORT_ID(9, 16)
#define SMI_PORT_LCESO_R1_C SMI_LARB_PORT_ID(9, 17)
#define SMI_PORT_CRZO_R1_C SMI_LARB_PORT_ID(9, 18)
#define SMI_PORT_LTMSO_R1_C SMI_LARB_PORT_ID(9, 19)
#define SMI_PORT_RSSO_R1_C SMI_LARB_PORT_ID(9, 20)
#define SMI_PORT_CCUI SMI_LARB_PORT_ID(9, 21)
#define SMI_PORT_CCUO SMI_LARB_PORT_ID(9, 22)
#define SMI_PORT_IMGO_R1_A SMI_LARB_PORT_ID(10, 0)
#define SMI_PORT_RRZO_R1_A SMI_LARB_PORT_ID(10, 1)
#define SMI_PORT_LSCI_R1_A SMI_LARB_PORT_ID(10, 2)
#define SMI_PORT_BPCI_R1_A SMI_LARB_PORT_ID(10, 3)
#define SMI_PORT_YUVO_R1_A SMI_LARB_PORT_ID(10, 4)
#define SMI_PORT_UFDI_R2_A SMI_LARB_PORT_ID(10, 5)
#define SMI_PORT_RAWI_R2_A SMI_LARB_PORT_ID(10, 6)
#define SMI_PORT_IMGO_R1_B SMI_LARB_PORT_ID(10, 8)
#define SMI_PORT_RRZO_R1_B SMI_LARB_PORT_ID(10, 9)
#define SMI_PORT_LSCI_R1_B SMI_LARB_PORT_ID(10, 10)
#define SMI_PORT_BPCI_R1_B SMI_LARB_PORT_ID(10, 11)
#define SMI_PORT_YUVO_R1_B SMI_LARB_PORT_ID(10, 12)
#define SMI_PORT_UFDI_R2_B SMI_LARB_PORT_ID(10, 13)
#define SMI_PORT_RAWI_R2_b SMI_LARB_PORT_ID(10, 14)
#define SMI_PORT_AAO_R1_A SMI_LARB_PORT_ID(10, 17)
#define SMI_PORT_AFO_R1_A SMI_LARB_PORT_ID(10, 18)
#define SMI_PORT_FLKO_R1_A SMI_LARB_PORT_ID(10, 19)
#define SMI_PORT_LCESO_R1_A SMI_LARB_PORT_ID(10, 20)
#define SMI_PORT_CRZO_R1_A SMI_LARB_PORT_ID(10, 21)
#define SMI_PORT_AAO_R1_B SMI_LARB_PORT_ID(10, 22)
#define SMI_PORT_AFO_R1_B SMI_LARB_PORT_ID(10, 23)
#define SMI_PORT_FLKO_R1_B SMI_LARB_PORT_ID(10, 24)
#define SMI_PORT_LCESO_R1_B SMI_LARB_PORT_ID(10, 25)
#define SMI_PORT_CRZO_R1_B SMI_LARB_PORT_ID(10, 26)
#define SMI_PORT_LTMSO_R1_A SMI_LARB_PORT_ID(10, 27)
#define SMI_PORT_RSSO_R1_A SMI_LARB_PORT_ID(10, 28)
#define SMI_PORT_LTMSO_R1_B SMI_LARB_PORT_ID(10, 29)
#define SMI_PORT_RSSO_R1_B SMI_LARB_PORT_ID(10, 30)
#endif
+531
View File
@@ -0,0 +1,531 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 1
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_ICFP (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = { /* ovl with large ostd */
{2, 3}, {1, 2}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{SMI_LARB0_PORT_NUM - 1, SMI_LARB0_PORT_NUM},
{SMI_LARB1_PORT_NUM - 1, SMI_LARB1_PORT_NUM},
{0, SMI_LARB2_PORT_NUM}, {0, 0},
{0, SMI_LARB4_PORT_NUM}, {0, 0}, {0, 0},
{0, SMI_LARB7_PORT_NUM}, {0, 0},
{0, SMI_LARB9_PORT_NUM}, {0, 0}, {0, SMI_LARB11_PORT_NUM}, {0, 0},
{SMI_LARB13_PORT_NUM - 1, SMI_LARB13_PORT_NUM}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, SMI_LARB19_PORT_NUM}, {0, SMI_LARB20_PORT_NUM},
};
/* conf */
#define SMI_COMM_CONF_NUM (7)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_BUS_SEL, 0x1414}, {SMI_M4U_TH, 0xe100e10},
{SMI_FIFO_TH1, 0x90a090a}, {SMI_FIFO_TH2, 0x506090a},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_SUB_COMM_CONF_NUM (4)
struct mtk_smi_pair smi_sub_comm_conf_pair[SMI_SUB_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xa}, {SMI_PREULTRA_MASK1, 0x2105},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_LARB0_CONF_NUM (2)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB15_CONF_NUM (2)
struct mtk_smi_pair smi_larb15_conf_pair[SMI_LARB15_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB16_CONF_NUM (3)
struct mtk_smi_pair smi_larb16_conf_pair[SMI_LARB16_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_FORCE_ULTRA, 0x8000},
{SMI_LARB_SW_FLAG, 0x1},
};
u32 smi_conf_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB15_CONF_NUM, SMI_LARB16_CONF_NUM, SMI_LARB16_CONF_NUM,
SMI_LARB16_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_DEV_NUM] = {
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb15_conf_pair, smi_larb16_conf_pair, smi_larb16_conf_pair,
smi_larb16_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_mdp_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sram_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sub_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x28},
{SMI_LARB_OSTDL_PORT(3), 0x28},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x18},
{SMI_LARB_OSTDL_PORT(2), 0x6},
{SMI_LARB_OSTDL_PORT(3), 0x6},
{SMI_LARB_OSTDL_PORT(4), 0x28},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x6},
{SMI_LARB_OSTDL_PORT(1), 0x6},
{SMI_LARB_OSTDL_PORT(2), 0x6},
{SMI_LARB_OSTDL_PORT(3), 0x6},
{SMI_LARB_OSTDL_PORT(4), 0x1},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = { };
struct mtk_smi_pair smi_larb4_init_pair[SMI_LARB4_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x18},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x2},
{SMI_LARB_OSTDL_PORT(13), 0x2},
};
struct mtk_smi_pair smi_larb5_init_pair[SMI_LARB5_PORT_NUM] = { };
struct mtk_smi_pair smi_larb6_init_pair[SMI_LARB6_PORT_NUM] = { };
struct mtk_smi_pair smi_larb7_init_pair[SMI_LARB7_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x3},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x3},
{SMI_LARB_OSTDL_PORT(6), 0x2},
{SMI_LARB_OSTDL_PORT(7), 0xd},
{SMI_LARB_OSTDL_PORT(8), 0x7},
{SMI_LARB_OSTDL_PORT(9), 0x5},
{SMI_LARB_OSTDL_PORT(10), 0x3},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x5},
};
struct mtk_smi_pair smi_larb8_init_pair[SMI_LARB8_PORT_NUM] = { };
struct mtk_smi_pair smi_larb9_init_pair[SMI_LARB9_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xa},
{SMI_LARB_OSTDL_PORT(1), 0x7},
{SMI_LARB_OSTDL_PORT(2), 0xf},
{SMI_LARB_OSTDL_PORT(3), 0x8},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x8},
{SMI_LARB_OSTDL_PORT(6), 0x9},
{SMI_LARB_OSTDL_PORT(7), 0x3},
{SMI_LARB_OSTDL_PORT(8), 0x3},
{SMI_LARB_OSTDL_PORT(9), 0x6},
{SMI_LARB_OSTDL_PORT(10), 0x7},
{SMI_LARB_OSTDL_PORT(11), 0x4},
{SMI_LARB_OSTDL_PORT(12), 0xa},
{SMI_LARB_OSTDL_PORT(13), 0x3},
{SMI_LARB_OSTDL_PORT(14), 0x4},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x8},
{SMI_LARB_OSTDL_PORT(19), 0x7},
{SMI_LARB_OSTDL_PORT(20), 0x7},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x6},
{SMI_LARB_OSTDL_PORT(23), 0x2},
{SMI_LARB_OSTDL_PORT(24), 0xf},
{SMI_LARB_OSTDL_PORT(25), 0x8},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb10_init_pair[SMI_LARB10_PORT_NUM] = { };
struct mtk_smi_pair smi_larb11_init_pair[SMI_LARB11_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xa},
{SMI_LARB_OSTDL_PORT(1), 0x7},
{SMI_LARB_OSTDL_PORT(2), 0xf},
{SMI_LARB_OSTDL_PORT(3), 0x8},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x8},
{SMI_LARB_OSTDL_PORT(6), 0x9},
{SMI_LARB_OSTDL_PORT(7), 0x3},
{SMI_LARB_OSTDL_PORT(8), 0x3},
{SMI_LARB_OSTDL_PORT(9), 0x6},
{SMI_LARB_OSTDL_PORT(10), 0x7},
{SMI_LARB_OSTDL_PORT(11), 0x4},
{SMI_LARB_OSTDL_PORT(12), 0xa},
{SMI_LARB_OSTDL_PORT(13), 0x3},
{SMI_LARB_OSTDL_PORT(14), 0x4},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x8},
{SMI_LARB_OSTDL_PORT(19), 0x7},
{SMI_LARB_OSTDL_PORT(20), 0x7},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x6},
{SMI_LARB_OSTDL_PORT(23), 0x2},
{SMI_LARB_OSTDL_PORT(24), 0xf},
{SMI_LARB_OSTDL_PORT(25), 0x8},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb12_init_pair[SMI_LARB12_PORT_NUM] = { };
struct mtk_smi_pair smi_larb13_init_pair[SMI_LARB13_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0xc},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x6},
{SMI_LARB_OSTDL_PORT(7), 0x6},
{SMI_LARB_OSTDL_PORT(8), 0x6},
{SMI_LARB_OSTDL_PORT(9), 0x12},
{SMI_LARB_OSTDL_PORT(10), 0x6},
{SMI_LARB_OSTDL_PORT(11), 0x1},
};
struct mtk_smi_pair smi_larb14_init_pair[SMI_LARB14_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x12},
{SMI_LARB_OSTDL_PORT(5), 0x6},
};
struct mtk_smi_pair smi_larb15_init_pair[SMI_LARB15_PORT_NUM] = { };
struct mtk_smi_pair smi_larb16_init_pair[SMI_LARB16_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb17_init_pair[SMI_LARB17_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb18_init_pair[SMI_LARB18_PORT_NUM] = { };
struct mtk_smi_pair smi_larb19_init_pair[SMI_LARB19_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x4},
{SMI_LARB_OSTDL_PORT(3), 0x2},
};
struct mtk_smi_pair smi_larb20_init_pair[SMI_LARB20_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x9},
{SMI_LARB_OSTDL_PORT(1), 0x9},
{SMI_LARB_OSTDL_PORT(2), 0x5},
{SMI_LARB_OSTDL_PORT(3), 0x5},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
};
/* scen: ALL */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair,
};
struct mtk_smi_pair *smi_sub_comm_scen_pair[SMI_SCEN_NUM] = {
smi_sub_comm_init_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair,
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair,
};
struct mtk_smi_pair *smi_larb4_scen_pair[SMI_SCEN_NUM] = {
smi_larb4_init_pair,
};
struct mtk_smi_pair *smi_larb5_scen_pair[SMI_SCEN_NUM] = {
smi_larb5_init_pair,
};
struct mtk_smi_pair *smi_larb6_scen_pair[SMI_SCEN_NUM] = {
smi_larb6_init_pair,
};
struct mtk_smi_pair *smi_larb7_scen_pair[SMI_SCEN_NUM] = {
smi_larb7_init_pair,
};
struct mtk_smi_pair *smi_larb8_scen_pair[SMI_SCEN_NUM] = {
smi_larb8_init_pair,
};
struct mtk_smi_pair *smi_larb9_scen_pair[SMI_SCEN_NUM] = {
smi_larb9_init_pair,
};
struct mtk_smi_pair *smi_larb10_scen_pair[SMI_SCEN_NUM] = {
smi_larb10_init_pair,
};
struct mtk_smi_pair *smi_larb11_scen_pair[SMI_SCEN_NUM] = {
smi_larb11_init_pair,
};
struct mtk_smi_pair *smi_larb12_scen_pair[SMI_SCEN_NUM] = {
smi_larb12_init_pair,
};
struct mtk_smi_pair *smi_larb13_scen_pair[SMI_SCEN_NUM] = {
smi_larb13_init_pair,
};
struct mtk_smi_pair *smi_larb14_scen_pair[SMI_SCEN_NUM] = {
smi_larb14_init_pair,
};
struct mtk_smi_pair *smi_larb15_scen_pair[SMI_SCEN_NUM] = {
smi_larb15_init_pair,
};
struct mtk_smi_pair *smi_larb16_scen_pair[SMI_SCEN_NUM] = {
smi_larb16_init_pair,
};
struct mtk_smi_pair *smi_larb17_scen_pair[SMI_SCEN_NUM] = {
smi_larb17_init_pair,
};
struct mtk_smi_pair *smi_larb18_scen_pair[SMI_SCEN_NUM] = {
smi_larb18_init_pair,
};
struct mtk_smi_pair *smi_larb19_scen_pair[SMI_SCEN_NUM] = {
smi_larb19_init_pair,
};
struct mtk_smi_pair *smi_larb20_scen_pair[SMI_SCEN_NUM] = {
smi_larb20_init_pair,
};
u32 smi_scen_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_LARB4_PORT_NUM, SMI_LARB5_PORT_NUM,
SMI_LARB6_PORT_NUM, SMI_LARB7_PORT_NUM, SMI_LARB8_PORT_NUM,
SMI_LARB9_PORT_NUM,
SMI_LARB10_PORT_NUM, SMI_LARB11_PORT_NUM, SMI_LARB12_PORT_NUM,
SMI_LARB13_PORT_NUM, SMI_LARB14_PORT_NUM, SMI_LARB15_PORT_NUM,
SMI_LARB16_PORT_NUM, SMI_LARB17_PORT_NUM, SMI_LARB18_PORT_NUM,
SMI_LARB19_PORT_NUM, SMI_LARB20_PORT_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_DEV_NUM] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_larb4_scen_pair, smi_larb5_scen_pair,
smi_larb6_scen_pair, smi_larb7_scen_pair, smi_larb8_scen_pair,
smi_larb9_scen_pair,
smi_larb10_scen_pair, smi_larb11_scen_pair, smi_larb12_scen_pair,
smi_larb13_scen_pair, smi_larb14_scen_pair, smi_larb15_scen_pair,
smi_larb16_scen_pair, smi_larb17_scen_pair, smi_larb18_scen_pair,
smi_larb19_scen_pair, smi_larb20_scen_pair,
smi_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
};
#define SMI_RSI_DEBUG_NUM (29 * 2)
#define SMI_RSI_M0_OFFSET (0x1000)
#define SMI_RSI_M1_OFFSET (0x2000)
u32 smi_rsi_debug_offset[SMI_RSI_DEBUG_NUM] = {
SMI_RSI_M0_OFFSET + RSI_INTLV_CON,
SMI_RSI_M0_OFFSET + RSI_DCM_CON,
SMI_RSI_M0_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M0_OFFSET + RSI_MISC_CON,
SMI_RSI_M0_OFFSET + RSI_STA,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WOSTD_S,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_AROSTD_S,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M1,
SMI_RSI_M1_OFFSET + RSI_INTLV_CON,
SMI_RSI_M1_OFFSET + RSI_DCM_CON,
SMI_RSI_M1_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M1_OFFSET + RSI_MISC_CON,
SMI_RSI_M1_OFFSET + RSI_STA,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WOSTD_S,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_AROSTD_S,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M1,
};
#endif
+44
View File
@@ -0,0 +1,44 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6781-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_ISP] = (1 << 9) | (1 << 28),
[SYS_ISP2] = (1 << 11),
[SYS_IPE] = (1 << 19) | (1 << 20) | (1 << 25),
[SYS_VDE] = (1 << 4),
[SYS_VEN] = (1 << 7),
[SYS_DIS] = (1 << 0) | (1 << 1) | (1 << 2) |
(1 << 21) | (1 << 22) | (1 << 23) | (1 << 24),
[SYS_CAM] = (1 << 13) | (1 << 14) | (1 << 26) | (1 << 27),
[SYS_CAM_RAWA] = (1 << 16),
[SYS_CAM_RAWB] = (1 << 17),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_ISP] = "ISP",
[SYS_ISP2] = "ISP2",
[SYS_IPE] = "IPE",
[SYS_VDE] = "VDE",
[SYS_VEN] = "VEN",
[SYS_DIS] = "DIS",
[SYS_CAM] = "CAM",
[SYS_CAM_RAWA] = "CAM_RAWA",
[SYS_CAM_RAWB] = "CAM_RAWB",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,58 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#include <dt-bindings/memory/mt6781-larb-port.h>
#define SMI_OSTD_MAX (0x3f)
#define SMI_COMM_MASTER_NUM (8)
#define SMI_LARB_NUM (21)
#define SMI_LARB0_PORT_NUM (4) /* SYS_DIS */
#define SMI_LARB1_PORT_NUM (5) /* SYS_DIS */
#define SMI_LARB2_PORT_NUM (5) /* SYS_MDP */
#define SMI_LARB3_PORT_NUM (0)
#define SMI_LARB4_PORT_NUM (14) /* SYS_VDE */
#define SMI_LARB5_PORT_NUM (0)
#define SMI_LARB6_PORT_NUM (0)
#define SMI_LARB7_PORT_NUM (13) /* SYS_VEN */
#define SMI_LARB8_PORT_NUM (0)
#define SMI_LARB9_PORT_NUM (29) /* SYS_IMG1 */
#define SMI_LARB10_PORT_NUM (0) /* SYS_IMG1 */
#define SMI_LARB11_PORT_NUM (29) /* SYS_IMG2 */
#define SMI_LARB12_PORT_NUM (0) /* SYS_IMG2 */
#define SMI_LARB13_PORT_NUM (12) /* SYS_CAM1 */
#define SMI_LARB14_PORT_NUM (6) /* SYS_CAM1 */
#define SMI_LARB15_PORT_NUM (0) /* SYS_CAM1 */
#define SMI_LARB16_PORT_NUM (17) /* SYS_CAM2 */
#define SMI_LARB17_PORT_NUM (17) /* SYS_CAM3 */
#define SMI_LARB18_PORT_NUM (0) /* SYS_CAM4 */
#define SMI_LARB19_PORT_NUM (4) /* SYS_IPE */
#define SMI_LARB20_PORT_NUM (6) /* SYS_IPE */
#define SMI_COMM_NUM (1 + 7)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
#define SMI_LARB_CCU0 (13)
#define SMI_LARB_CCU1 (14)
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 1, 0, 0, 1, 1, 0,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 4, SMI_COMM_MASTER_NUM, 2, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
3, SMI_COMM_MASTER_NUM, 5, SMI_COMM_MASTER_NUM, 5, SMI_COMM_MASTER_NUM,
7, 6, SMI_COMM_MASTER_NUM, 6, 7, SMI_COMM_MASTER_NUM, 5, 5};
static const u8
SMI_LARB_PORT_NUM[SMI_LARB_NUM] = {
4, 5, 5, 0, 14, 0, 0, 13, 0, 29, 0, 29, 0, 12, 6, 0, 17, 17, 0, 4, 6};
#endif
+236
View File
@@ -0,0 +1,236 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM (1)
#define SMI_ESL_INIT (0)
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
#define SMI_ESL_ICFP (SMI_ESL_INIT)
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{0, 0}, {5, SMI_LARB1_PORT_NUM}, {0, SMI_LARB2_PORT_NUM},
{0, SMI_LARB3_PORT_NUM}, {0, 0}, {0, SMI_LARB5_PORT_NUM},
{0, 0}, {0, 0},
};
/* conf */
#define SMI_LARB0_CONF_NUM (11)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_WRR_PORT(0), 0xb}, {SMI_LARB_WRR_PORT(1), 0xb},
{SMI_LARB_WRR_PORT(2), 0xb}, {SMI_LARB_WRR_PORT(3), 0x5},
{SMI_LARB_WRR_PORT(4), 0x5}, {SMI_LARB_WRR_PORT(5), 0xb},
{SMI_LARB_WRR_PORT(6), 0xb}, {SMI_LARB_WRR_PORT(7), 0xb},
{SMI_LARB_WRR_PORT(8), 0xb},
};
#define SMI_LARB1_CONF_NUM (16)
struct mtk_smi_pair smi_larb1_conf_pair[SMI_LARB1_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_WRR_PORT(0), 0xb}, {SMI_LARB_WRR_PORT(1), 0xb},
{SMI_LARB_WRR_PORT(2), 0x5}, {SMI_LARB_WRR_PORT(3), 0x5},
{SMI_LARB_WRR_PORT(4), 0xb}, {SMI_LARB_WRR_PORT(5), 0x1},
{SMI_LARB_WRR_PORT(6), 0x1}, {SMI_LARB_WRR_PORT(7), 0x1},
{SMI_LARB_WRR_PORT(8), 0x1}, {SMI_LARB_WRR_PORT(9), 0x1},
{SMI_LARB_WRR_PORT(10), 0x1}, {SMI_LARB_WRR_PORT(11), 0x1},
{SMI_LARB_WRR_PORT(12), 0x1}, {SMI_LARB_WRR_PORT(13), 0x4},
};
#define SMI_LARB2_CONF_NUM (2)
struct mtk_smi_pair smi_larb2_conf_pair[SMI_LARB2_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB3_CONF_NUM (2)
struct mtk_smi_pair smi_larb3_conf_pair[SMI_LARB3_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_COMM_CONF_NUM (6)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_M4U_TH, 0xe100e10}, {SMI_FIFO_TH1, 0x506090a},
{SMI_FIFO_TH2, 0x506090a}, {SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
u32 smi_conf_pair_num[SMI_LARB_NUM + 1] = {
SMI_LARB0_CONF_NUM, SMI_LARB1_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB3_CONF_NUM, SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB3_CONF_NUM, SMI_LARB3_CONF_NUM,
SMI_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_LARB_NUM + 1] = {
smi_larb0_conf_pair, smi_larb1_conf_pair, smi_larb2_conf_pair,
smi_larb3_conf_pair, smi_larb2_conf_pair, smi_larb2_conf_pair,
smi_larb3_conf_pair, smi_larb3_conf_pair,
smi_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2}, {SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x1}, {SMI_LARB_OSTDL_PORT(3), 0x1f},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0xa}, {SMI_LARB_OSTDL_PORT(7), 0xa},
{SMI_LARB_OSTDL_PORT(8), 0x28},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1c}, {SMI_LARB_OSTDL_PORT(3), 0x1c},
{SMI_LARB_OSTDL_PORT(4), 0xa}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0xd},
{SMI_LARB_OSTDL_PORT(8), 0xd}, {SMI_LARB_OSTDL_PORT(9), 0xe},
{SMI_LARB_OSTDL_PORT(10), 0x1}, {SMI_LARB_OSTDL_PORT(11), 0xe},
{SMI_LARB_OSTDL_PORT(12), 0x1}, {SMI_LARB_OSTDL_PORT(13), 0x28},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x18}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x8}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x1}, {SMI_LARB_OSTDL_PORT(11), 0x1},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1}, {SMI_LARB_OSTDL_PORT(1), 0x3},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1}, {SMI_LARB_OSTDL_PORT(7), 0x4},
{SMI_LARB_OSTDL_PORT(8), 0x2}, {SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x4}, {SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x1}, {SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x1}, {SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0xb}, {SMI_LARB_OSTDL_PORT(17), 0x13},
{SMI_LARB_OSTDL_PORT(18), 0x14},
};
struct mtk_smi_pair smi_larb4_init_pair[SMI_LARB4_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
};
struct mtk_smi_pair smi_larb5_init_pair[SMI_LARB5_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xc}, {SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x4}, {SMI_LARB_OSTDL_PORT(3), 0x4},
{SMI_LARB_OSTDL_PORT(4), 0x1}, {SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x2}, {SMI_LARB_OSTDL_PORT(7), 0x6},
{SMI_LARB_OSTDL_PORT(8), 0x1}, {SMI_LARB_OSTDL_PORT(9), 0x9},
{SMI_LARB_OSTDL_PORT(10), 0x2}, {SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x2}, {SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x6}, {SMI_LARB_OSTDL_PORT(15), 0x9},
{SMI_LARB_OSTDL_PORT(16), 0x1}, {SMI_LARB_OSTDL_PORT(17), 0x1},
{SMI_LARB_OSTDL_PORT(18), 0x6}, {SMI_LARB_OSTDL_PORT(19), 0x4},
{SMI_LARB_OSTDL_PORT(20), 0x4}, {SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x1}, {SMI_LARB_OSTDL_PORT(23), 0x1},
{SMI_LARB_OSTDL_PORT(24), 0x1}, {SMI_LARB_OSTDL_PORT(25), 0x2},
};
struct mtk_smi_pair smi_larb6_init_pair[SMI_LARB6_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1f}, {SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2}, {SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2}, {SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x16}, {SMI_LARB_OSTDL_PORT(7), 0x8},
{SMI_LARB_OSTDL_PORT(8), 0x2}, {SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x2}, {SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0xa}, {SMI_LARB_OSTDL_PORT(13), 0xa},
{SMI_LARB_OSTDL_PORT(14), 0x4}, {SMI_LARB_OSTDL_PORT(15), 0x2},
{SMI_LARB_OSTDL_PORT(16), 0x2}, {SMI_LARB_OSTDL_PORT(17), 0x2},
{SMI_LARB_OSTDL_PORT(18), 0x2}, {SMI_LARB_OSTDL_PORT(19), 0x2},
{SMI_LARB_OSTDL_PORT(20), 0x2}, {SMI_LARB_OSTDL_PORT(21), 0x2},
{SMI_LARB_OSTDL_PORT(22), 0x2}, {SMI_LARB_OSTDL_PORT(23), 0x2},
{SMI_LARB_OSTDL_PORT(24), 0x2}, {SMI_LARB_OSTDL_PORT(25), 0x1},
{SMI_LARB_OSTDL_PORT(26), 0x1}, {SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1}, {SMI_LARB_OSTDL_PORT(29), 0x1},
{SMI_LARB_OSTDL_PORT(30), 0x1},
};
struct mtk_smi_pair smi_larb7_init_pair[SMI_LARB7_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1f}, {SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x1f}, {SMI_LARB_OSTDL_PORT(3), 0x1f},
{SMI_LARB_OSTDL_PORT(4), 0x14},
};
struct mtk_smi_pair smi_comm_init_pair[SMI_LARB_NUM + 1] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
/* scen: ALL */
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair,
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair,
};
struct mtk_smi_pair *smi_larb4_scen_pair[SMI_SCEN_NUM] = {
smi_larb4_init_pair,
};
struct mtk_smi_pair *smi_larb5_scen_pair[SMI_SCEN_NUM] = {
smi_larb5_init_pair,
};
struct mtk_smi_pair *smi_larb6_scen_pair[SMI_SCEN_NUM] = {
smi_larb6_init_pair,
};
struct mtk_smi_pair *smi_larb7_scen_pair[SMI_SCEN_NUM] = {
smi_larb7_init_pair,
};
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair,
};
u32 smi_scen_pair_num[SMI_LARB_NUM + 1] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_LARB4_PORT_NUM, SMI_LARB5_PORT_NUM,
SMI_LARB6_PORT_NUM, SMI_LARB7_PORT_NUM,
SMI_COMM_MASTER_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_LARB_NUM + 1] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_larb4_scen_pair, smi_larb5_scen_pair,
smi_larb6_scen_pair, smi_larb7_scen_pair,
smi_comm_scen_pair,
};
#endif
+30
View File
@@ -0,0 +1,30 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6785-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_DIS] = ((1 << 0) | (1 << 1) | (1 << (SMI_LARB_NUM))),
[SYS_VDE] = (1 << 2),
[SYS_VEN] = (1 << 3),
[SYS_ISP] = ((1 << 4) | (1 << 5)),
[SYS_CAM] = ((1 << 6) | (1 << 7)),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile_function.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_DIS] = "DIS", [SYS_VDE] = "VDE", [SYS_VEN] = "VEN",
[SYS_ISP] = "ISP", [SYS_CAM] = "CAM",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
+125
View File
@@ -0,0 +1,125 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#define SMI_OSTD_MAX (0x1f)
#define SMI_LARB_NUM (8)
#define SMI_LARB0_PORT_NUM (9) /* SYS_DIS */
#define SMI_LARB1_PORT_NUM (14) /* SYS_DIS */
#define SMI_LARB2_PORT_NUM (12) /* SYS_VDE */
#define SMI_LARB3_PORT_NUM (19) /* SYS_VEN */
#define SMI_LARB4_PORT_NUM (3) /* SYS_ISP */
#define SMI_LARB5_PORT_NUM (26) /* SYS_ISP */
#define SMI_LARB6_PORT_NUM (31) /* SYS_CAM */
#define SMI_LARB7_PORT_NUM (5) /* SYS_CAM */
#define SMI_COMM_MASTER_NUM (SMI_LARB_NUM)
#define SMI_COMM_NUM (1)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 1, 0, 1, 1, 1, 1,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 2, 3, SMI_COMM_MASTER_NUM, 4, 7, SMI_COMM_MASTER_NUM};
#define SMI_LARB_PORT_ID(l, p) (((l) << 16) | ((p) & 0xffff))
#define SMI_DISP_POSTMASK0 SMI_LARB_PORT_ID(0, 0)
#define SMI_DISP_OVL0_HDR SMI_LARB_PORT_ID(0, 1)
#define SMI_DISP_OVL0 SMI_LARB_PORT_ID(0, 3)
#define SMI_DISP_RDMA0 SMI_LARB_PORT_ID(0, 6)
#define SMI_DISP_WDMA0 SMI_LARB_PORT_ID(0, 7)
#define SMI_DISP_OVL0_2L_HDR SMI_LARB_PORT_ID(1, 0)
#define SMI_DISP_OVL0_2L SMI_LARB_PORT_ID(1, 2)
#define SMI_DISP_OVL1_2L SMI_LARB_PORT_ID(1, 3)
#define SMI_DISP_RDMA1 SMI_LARB_PORT_ID(1, 4)
#define SMI_MDP_RDMA0 SMI_LARB_PORT_ID(1, 7)
#define SMI_MDP_RDMA1 SMI_LARB_PORT_ID(1, 8)
#define SMI_MDP_WROT0_R SMI_LARB_PORT_ID(1, 9)
#define SMI_MDP_WROT1_R SMI_LARB_PORT_ID(1, 11)
#define SMI_HW_VDEC_MC_EXT SMI_LARB_PORT_ID(2, 0)
#define SMI_HW_VDEC_UFO_EXT SMI_LARB_PORT_ID(2, 1)
#define SMI_HW_VDEC_PP_EXT SMI_LARB_PORT_ID(2, 2)
#define SMI_HW_VDEC_PRED_RD_EXT SMI_LARB_PORT_ID(2, 3)
#define SMI_HW_VDEC_PRED_WR_EXT SMI_LARB_PORT_ID(2, 4)
#define SMI_HW_VDEC_PPWRAP_EXT SMI_LARB_PORT_ID(2, 5)
#define SMI_HW_VDEC_TILE_EXT SMI_LARB_PORT_ID(2, 6)
#define SMI_HW_VDEC_VLD_EXT SMI_LARB_PORT_ID(2, 7)
#define SMI_HW_VDEC_VLD2_EXT SMI_LARB_PORT_ID(2, 8)
#define SMI_HW_VDEC_AVC_MV_EXT SMI_LARB_PORT_ID(2, 9)
#define SMI_HW_VDEC_UFO_ENC_EXT SMI_LARB_PORT_ID(2, 10)
#define SMI_HW_VDEC_RG_CTRL_DMA_EXT SMI_LARB_PORT_ID(2, 11)
#define SMI_VENC_RCPU SMI_LARB_PORT_ID(3, 0)
#define SMI_VENC_REC SMI_LARB_PORT_ID(3, 1)
#define SMI_VENC_BSDMA SMI_LARB_PORT_ID(3, 2)
#define SMI_VENC_SV_COMV SMI_LARB_PORT_ID(3, 3)
#define SMI_VENC_RD_COMV SMI_LARB_PORT_ID(3, 4)
#define SMI_JPGENC_Y_RDMA SMI_LARB_PORT_ID(3, 7)
#define SMI_JPGENC_C_RDMA SMI_LARB_PORT_ID(3, 8)
#define SMI_JPGENC_Q_TABLE SMI_LARB_PORT_ID(3, 9)
#define SMI_JPGENC_BSDMA SMI_LARB_PORT_ID(3, 10)
#define SMI_VENC_CUR_LUMA SMI_LARB_PORT_ID(3, 15)
#define SMI_VENC_CUR_CHROMA SMI_LARB_PORT_ID(3, 16)
#define SMI_VENC_REF_LUMA SMI_LARB_PORT_ID(3, 17)
#define SMI_VENC_REF_CHROMA SMI_LARB_PORT_ID(3, 18)
#define SMI_IMGI SMI_LARB_PORT_ID(5, 0)
#define SMI_IMG2O SMI_LARB_PORT_ID(5, 1)
#define SMI_IMG3O SMI_LARB_PORT_ID(5, 2)
#define SMI_VIPI SMI_LARB_PORT_ID(5, 3)
#define SMI_LCEI SMI_LARB_PORT_ID(5, 4)
#define SMI_SMXI SMI_LARB_PORT_ID(5, 5)
#define SMI_SMXO SMI_LARB_PORT_ID(5, 6)
#define SMI_WPE0_RDMA1 SMI_LARB_PORT_ID(5, 7)
#define SMI_WPE0_RDMA0 SMI_LARB_PORT_ID(5, 8)
#define SMI_WPE0_WDMA SMI_LARB_PORT_ID(5, 9)
#define SMI_FDVT_RDB SMI_LARB_PORT_ID(5, 10)
#define SMI_FDVT_WRA SMI_LARB_PORT_ID(5, 11)
#define SMI_FDVT_RDA SMI_LARB_PORT_ID(5, 12)
#define SMI_WPE1_RDMA0 SMI_LARB_PORT_ID(5, 13)
#define SMI_WPE1_RDMA1 SMI_LARB_PORT_ID(5, 14)
#define SMI_WPE1_WDMA SMI_LARB_PORT_ID(5, 15)
#define SMI_DPE_RDMA SMI_LARB_PORT_ID(5, 16)
#define SMI_DPE_WDMA SMI_LARB_PORT_ID(5, 17)
#define SMI_MFB_RDMA0 SMI_LARB_PORT_ID(5, 18)
#define SMI_MFB_RDMA1 SMI_LARB_PORT_ID(5, 19)
#define SMI_MFB_WDMA SMI_LARB_PORT_ID(5, 20)
#define SMI_RSC_RDMA0 SMI_LARB_PORT_ID(5, 21)
#define SMI_RSC_WDMA SMI_LARB_PORT_ID(5, 22)
#define SMI_OWE_RDMA SMI_LARB_PORT_ID(5, 23)
#define SMI_OWE_WDMA SMI_LARB_PORT_ID(5, 24)
#define SMI_FDVT_WRB SMI_LARB_PORT_ID(5, 25)
#define SMI_IMGO SMI_LARB_PORT_ID(6, 0)
#define SMI_RRZO SMI_LARB_PORT_ID(6, 1)
#define SMI_AAO SMI_LARB_PORT_ID(6, 2)
#define SMI_AFO SMI_LARB_PORT_ID(6, 3)
#define SMI_LSCI_0 SMI_LARB_PORT_ID(6, 4)
#define SMI_LSCI_1 SMI_LARB_PORT_ID(6, 5)
#define SMI_PDO SMI_LARB_PORT_ID(6, 6)
#define SMI_BPCI SMI_LARB_PORT_ID(6, 7)
#define SMI_LCSO SMI_LARB_PORT_ID(6, 8)
#define SMI_AFO_1 SMI_LARB_PORT_ID(6, 9)
#define SMI_PSO SMI_LARB_PORT_ID(6, 10)
#define SMI_LSCI_2 SMI_LARB_PORT_ID(6, 11)
#define SMI_SOC0 SMI_LARB_PORT_ID(6, 12)
#define SMI_SOC1 SMI_LARB_PORT_ID(6, 13)
#define SMI_SOC2 SMI_LARB_PORT_ID(6, 14)
#define SMI_CCUI SMI_LARB_PORT_ID(6, 15)
#define SMI_CCUO SMI_LARB_PORT_ID(6, 16)
#define SMI_UFEO SMI_LARB_PORT_ID(6, 17)
#define SMI_RAWI_A SMI_LARB_PORT_ID(6, 18)
#define SMI_RSSO_A SMI_LARB_PORT_ID(6, 19)
#define SMI_CCUG SMI_LARB_PORT_ID(6, 20)
#define SMI_PDI SMI_LARB_PORT_ID(6, 21)
#define SMI_FLKO SMI_LARB_PORT_ID(6, 22)
#define SMI_LMVO SMI_LARB_PORT_ID(6, 23)
#define SMI_UFGO SMI_LARB_PORT_ID(6, 24)
#endif
+551
View File
@@ -0,0 +1,551 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 1
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_ICFP (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{5, 8}, {5, 8}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{SMI_LARB0_PORT_NUM - 1, SMI_LARB0_PORT_NUM},
{SMI_LARB1_PORT_NUM - 1, SMI_LARB1_PORT_NUM},
{0, SMI_LARB2_PORT_NUM}, {0, 0},
{0, SMI_LARB4_PORT_NUM}, {0, 0}, {0, 0},
{0, SMI_LARB7_PORT_NUM}, {0, 0},
{0, SMI_LARB9_PORT_NUM}, {0, 0}, {0, SMI_LARB11_PORT_NUM}, {0, 0},
{SMI_LARB13_PORT_NUM - 1, SMI_LARB13_PORT_NUM}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, SMI_LARB19_PORT_NUM}, {0, SMI_LARB20_PORT_NUM},
};
/* conf */
#define SMI_COMM_CONF_NUM (7)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_BUS_SEL, 0x4514}, {SMI_M4U_TH, 0xe100e10},
{SMI_FIFO_TH1, 0x9100910}, {SMI_FIFO_TH2, 0x5060910},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_SUB_COMM_CONF_NUM (4)
struct mtk_smi_pair smi_sub_comm_conf_pair[SMI_SUB_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xa}, {SMI_PREULTRA_MASK1, 0x2105},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_LARB0_CONF_NUM (2)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB15_CONF_NUM (2)
struct mtk_smi_pair smi_larb15_conf_pair[SMI_LARB15_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB16_CONF_NUM (3)
struct mtk_smi_pair smi_larb16_conf_pair[SMI_LARB16_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_FORCE_ULTRA, 0x8000},
{SMI_LARB_SW_FLAG, 0x1},
};
u32 smi_conf_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB15_CONF_NUM, SMI_LARB16_CONF_NUM, SMI_LARB16_CONF_NUM,
SMI_LARB16_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_DEV_NUM] = {
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb15_conf_pair, smi_larb16_conf_pair, smi_larb16_conf_pair,
smi_larb16_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_mdp_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sram_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sub_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x28},
{SMI_LARB_OSTDL_PORT(3), 0x28},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x18},
{SMI_LARB_OSTDL_PORT(2), 0x6},
{SMI_LARB_OSTDL_PORT(3), 0x6},
{SMI_LARB_OSTDL_PORT(4), 0x28},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x6},
{SMI_LARB_OSTDL_PORT(1), 0x6},
{SMI_LARB_OSTDL_PORT(2), 0x6},
{SMI_LARB_OSTDL_PORT(3), 0x6},
{SMI_LARB_OSTDL_PORT(4), 0x1},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = { };
struct mtk_smi_pair smi_larb4_init_pair[SMI_LARB4_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x1},
{SMI_LARB_OSTDL_PORT(11), 0x18},
};
struct mtk_smi_pair smi_larb5_init_pair[SMI_LARB5_PORT_NUM] = { };
struct mtk_smi_pair smi_larb6_init_pair[SMI_LARB6_PORT_NUM] = { };
struct mtk_smi_pair smi_larb7_init_pair[SMI_LARB7_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x3},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x3},
{SMI_LARB_OSTDL_PORT(6), 0x2},
{SMI_LARB_OSTDL_PORT(7), 0xd},
{SMI_LARB_OSTDL_PORT(8), 0x7},
{SMI_LARB_OSTDL_PORT(9), 0x5},
{SMI_LARB_OSTDL_PORT(10), 0x3},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x5},
};
struct mtk_smi_pair smi_larb8_init_pair[SMI_LARB8_PORT_NUM] = { };
struct mtk_smi_pair smi_larb9_init_pair[SMI_LARB9_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xa},
{SMI_LARB_OSTDL_PORT(1), 0x7},
{SMI_LARB_OSTDL_PORT(2), 0xf},
{SMI_LARB_OSTDL_PORT(3), 0x8},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x8},
{SMI_LARB_OSTDL_PORT(6), 0x9},
{SMI_LARB_OSTDL_PORT(7), 0x3},
{SMI_LARB_OSTDL_PORT(8), 0x3},
{SMI_LARB_OSTDL_PORT(9), 0x6},
{SMI_LARB_OSTDL_PORT(10), 0x7},
{SMI_LARB_OSTDL_PORT(11), 0x4},
{SMI_LARB_OSTDL_PORT(12), 0xa},
{SMI_LARB_OSTDL_PORT(13), 0x3},
{SMI_LARB_OSTDL_PORT(14), 0x4},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x1},
{SMI_LARB_OSTDL_PORT(19), 0x1},
{SMI_LARB_OSTDL_PORT(20), 0x1},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x1},
{SMI_LARB_OSTDL_PORT(23), 0x1},
{SMI_LARB_OSTDL_PORT(24), 0x1},
{SMI_LARB_OSTDL_PORT(25), 0x1},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb10_init_pair[SMI_LARB10_PORT_NUM] = { };
struct mtk_smi_pair smi_larb11_init_pair[SMI_LARB11_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x1},
{SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x1},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x8},
{SMI_LARB_OSTDL_PORT(19), 0x7},
{SMI_LARB_OSTDL_PORT(20), 0x7},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x6},
{SMI_LARB_OSTDL_PORT(23), 0x2},
{SMI_LARB_OSTDL_PORT(24), 0xf},
{SMI_LARB_OSTDL_PORT(25), 0x8},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb12_init_pair[SMI_LARB12_PORT_NUM] = { };
struct mtk_smi_pair smi_larb13_init_pair[SMI_LARB13_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0xc},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x6},
{SMI_LARB_OSTDL_PORT(7), 0x6},
{SMI_LARB_OSTDL_PORT(8), 0x6},
{SMI_LARB_OSTDL_PORT(9), 0x12},
{SMI_LARB_OSTDL_PORT(10), 0x6},
{SMI_LARB_OSTDL_PORT(11), 0x1},
};
struct mtk_smi_pair smi_larb14_init_pair[SMI_LARB14_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x12},
{SMI_LARB_OSTDL_PORT(5), 0x6},
};
struct mtk_smi_pair smi_larb15_init_pair[SMI_LARB15_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x28},
{SMI_LARB_OSTDL_PORT(4), 0x1},
};
struct mtk_smi_pair smi_larb16_init_pair[SMI_LARB16_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb17_init_pair[SMI_LARB17_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb18_init_pair[SMI_LARB18_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb19_init_pair[SMI_LARB19_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x4},
{SMI_LARB_OSTDL_PORT(3), 0x2},
};
struct mtk_smi_pair smi_larb20_init_pair[SMI_LARB20_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x9},
{SMI_LARB_OSTDL_PORT(1), 0x9},
{SMI_LARB_OSTDL_PORT(2), 0x5},
{SMI_LARB_OSTDL_PORT(3), 0x5},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
};
/* scen: ALL */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair,
};
struct mtk_smi_pair *smi_sub_comm_scen_pair[SMI_SCEN_NUM] = {
smi_sub_comm_init_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair,
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair,
};
struct mtk_smi_pair *smi_larb4_scen_pair[SMI_SCEN_NUM] = {
smi_larb4_init_pair,
};
struct mtk_smi_pair *smi_larb5_scen_pair[SMI_SCEN_NUM] = {
smi_larb5_init_pair,
};
struct mtk_smi_pair *smi_larb6_scen_pair[SMI_SCEN_NUM] = {
smi_larb6_init_pair,
};
struct mtk_smi_pair *smi_larb7_scen_pair[SMI_SCEN_NUM] = {
smi_larb7_init_pair,
};
struct mtk_smi_pair *smi_larb8_scen_pair[SMI_SCEN_NUM] = {
smi_larb8_init_pair,
};
struct mtk_smi_pair *smi_larb9_scen_pair[SMI_SCEN_NUM] = {
smi_larb9_init_pair,
};
struct mtk_smi_pair *smi_larb10_scen_pair[SMI_SCEN_NUM] = {
smi_larb10_init_pair,
};
struct mtk_smi_pair *smi_larb11_scen_pair[SMI_SCEN_NUM] = {
smi_larb11_init_pair,
};
struct mtk_smi_pair *smi_larb12_scen_pair[SMI_SCEN_NUM] = {
smi_larb12_init_pair,
};
struct mtk_smi_pair *smi_larb13_scen_pair[SMI_SCEN_NUM] = {
smi_larb13_init_pair,
};
struct mtk_smi_pair *smi_larb14_scen_pair[SMI_SCEN_NUM] = {
smi_larb14_init_pair,
};
struct mtk_smi_pair *smi_larb15_scen_pair[SMI_SCEN_NUM] = {
smi_larb15_init_pair,
};
struct mtk_smi_pair *smi_larb16_scen_pair[SMI_SCEN_NUM] = {
smi_larb16_init_pair,
};
struct mtk_smi_pair *smi_larb17_scen_pair[SMI_SCEN_NUM] = {
smi_larb17_init_pair,
};
struct mtk_smi_pair *smi_larb18_scen_pair[SMI_SCEN_NUM] = {
smi_larb18_init_pair,
};
struct mtk_smi_pair *smi_larb19_scen_pair[SMI_SCEN_NUM] = {
smi_larb19_init_pair,
};
struct mtk_smi_pair *smi_larb20_scen_pair[SMI_SCEN_NUM] = {
smi_larb20_init_pair,
};
u32 smi_scen_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_LARB4_PORT_NUM, SMI_LARB5_PORT_NUM,
SMI_LARB6_PORT_NUM, SMI_LARB7_PORT_NUM, SMI_LARB8_PORT_NUM,
SMI_LARB9_PORT_NUM,
SMI_LARB10_PORT_NUM, SMI_LARB11_PORT_NUM, SMI_LARB12_PORT_NUM,
SMI_LARB13_PORT_NUM, SMI_LARB14_PORT_NUM, SMI_LARB15_PORT_NUM,
SMI_LARB16_PORT_NUM, SMI_LARB17_PORT_NUM, SMI_LARB18_PORT_NUM,
SMI_LARB19_PORT_NUM, SMI_LARB20_PORT_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_DEV_NUM] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_larb4_scen_pair, smi_larb5_scen_pair,
smi_larb6_scen_pair, smi_larb7_scen_pair, smi_larb8_scen_pair,
smi_larb9_scen_pair,
smi_larb10_scen_pair, smi_larb11_scen_pair, smi_larb12_scen_pair,
smi_larb13_scen_pair, smi_larb14_scen_pair, smi_larb15_scen_pair,
smi_larb16_scen_pair, smi_larb17_scen_pair, smi_larb18_scen_pair,
smi_larb19_scen_pair, smi_larb20_scen_pair,
smi_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
};
#define SMI_RSI_DEBUG_NUM (29 * 2)
#define SMI_RSI_M0_OFFSET (0x1000)
#define SMI_RSI_M1_OFFSET (0x2000)
u32 smi_rsi_debug_offset[SMI_RSI_DEBUG_NUM] = {
SMI_RSI_M0_OFFSET + RSI_INTLV_CON,
SMI_RSI_M0_OFFSET + RSI_DCM_CON,
SMI_RSI_M0_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M0_OFFSET + RSI_MISC_CON,
SMI_RSI_M0_OFFSET + RSI_STA,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WOSTD_S,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_AROSTD_S,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M1,
SMI_RSI_M1_OFFSET + RSI_INTLV_CON,
SMI_RSI_M1_OFFSET + RSI_DCM_CON,
SMI_RSI_M1_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M1_OFFSET + RSI_MISC_CON,
SMI_RSI_M1_OFFSET + RSI_STA,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WOSTD_S,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_AROSTD_S,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M1,
};
#endif
+42
View File
@@ -0,0 +1,42 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6833-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_ISP] = (1 << 9) | (1 << 28),
[SYS_ISP2] = (1 << 11),
[SYS_IPE] = (1 << 19) | (1 << 20) | (1 << 25),
[SYS_VDE] = (1 << 4),
[SYS_VEN] = (1 << 7),
[SYS_DIS] = (1 << 0) | (1 << 1) | (1 << 2) |
(1 << 21) | (1 << 22) | (1 << 23) | (1 << 24),
[SYS_CAM] = (1 << 13) | (1 << 14) | (1 << 26) | (1 << 27),
[SYS_CAM_RAWA] = (1 << 16),
[SYS_CAM_RAWB] = (1 << 17),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_ISP] = "ISP",
[SYS_ISP2] = "ISP2",
[SYS_IPE] = "IPE",
[SYS_VDE] = "VDE",
[SYS_VEN] = "VEN",
[SYS_DIS] = "DIS",
[SYS_CAM] = "CAM",
[SYS_CAM_RAWA] = "CAM_RAWA",
[SYS_CAM_RAWB] = "CAM_RAWB",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,56 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#include <dt-bindings/memory/mt6833-larb-port.h>
#define SMI_OSTD_MAX (0x3f)
#define SMI_COMM_MASTER_NUM (8)
#define SMI_LARB_NUM (21)
#define SMI_LARB0_PORT_NUM (4) /* SYS_DIS */
#define SMI_LARB1_PORT_NUM (5) /* SYS_DIS */
#define SMI_LARB2_PORT_NUM (5) /* SYS_MDP */
#define SMI_LARB3_PORT_NUM (0)
#define SMI_LARB4_PORT_NUM (12) /* SYS_VDE */
#define SMI_LARB5_PORT_NUM (0)
#define SMI_LARB6_PORT_NUM (0)
#define SMI_LARB7_PORT_NUM (13) /* SYS_VEN */
#define SMI_LARB8_PORT_NUM (0)
#define SMI_LARB9_PORT_NUM (29) /* SYS_IMG1 */
#define SMI_LARB10_PORT_NUM (0) /* SYS_IMG1 */
#define SMI_LARB11_PORT_NUM (29) /* SYS_IMG2 */
#define SMI_LARB12_PORT_NUM (0) /* SYS_IMG2 */
#define SMI_LARB13_PORT_NUM (12) /* SYS_CAM1 */
#define SMI_LARB14_PORT_NUM (6) /* SYS_CAM1 */
#define SMI_LARB15_PORT_NUM (5) /* SYS_CAM1 */
#define SMI_LARB16_PORT_NUM (17) /* SYS_CAM2 */
#define SMI_LARB17_PORT_NUM (17) /* SYS_CAM3 */
#define SMI_LARB18_PORT_NUM (17) /* SYS_CAM4 */
#define SMI_LARB19_PORT_NUM (4) /* SYS_IPE */
#define SMI_LARB20_PORT_NUM (6) /* SYS_IPE */
#define SMI_COMM_NUM (1 + 7)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
#define SMI_LARB_CCU0 (13)
#define SMI_LARB_CCU1 (14)
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 1, 0, 1, 1, 0, 1,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 4, SMI_COMM_MASTER_NUM, 2, 2, SMI_COMM_MASTER_NUM,
3, SMI_COMM_MASTER_NUM, 5, SMI_COMM_MASTER_NUM, 5, SMI_COMM_MASTER_NUM,
7, 6, SMI_COMM_MASTER_NUM, 6, 7, 7, 5, 5};
static const u8
SMI_LARB_PORT_NUM[SMI_LARB_NUM] = {
4, 5, 5, 0, 12, 0, 0, 13, 0, 29, 0, 29, 0, 12, 6, 5, 17, 17, 17, 4, 6};
#endif
+551
View File
@@ -0,0 +1,551 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 1
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_ICFP (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{5, 8}, {5, 8}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{SMI_LARB0_PORT_NUM - 1, SMI_LARB0_PORT_NUM},
{SMI_LARB1_PORT_NUM - 1, SMI_LARB1_PORT_NUM},
{0, SMI_LARB2_PORT_NUM}, {0, 0},
{0, SMI_LARB4_PORT_NUM}, {0, 0}, {0, 0},
{0, SMI_LARB7_PORT_NUM}, {0, 0},
{0, SMI_LARB9_PORT_NUM}, {0, 0}, {0, SMI_LARB11_PORT_NUM}, {0, 0},
{SMI_LARB13_PORT_NUM - 1, SMI_LARB13_PORT_NUM}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, SMI_LARB19_PORT_NUM}, {0, SMI_LARB20_PORT_NUM},
};
/* conf */
#define SMI_COMM_CONF_NUM (7)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_BUS_SEL, 0x4514}, {SMI_M4U_TH, 0xe100e10},
{SMI_FIFO_TH1, 0x9100910}, {SMI_FIFO_TH2, 0x5060910},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_SUB_COMM_CONF_NUM (4)
struct mtk_smi_pair smi_sub_comm_conf_pair[SMI_SUB_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xa}, {SMI_PREULTRA_MASK1, 0x2105},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_LARB0_CONF_NUM (2)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB15_CONF_NUM (2)
struct mtk_smi_pair smi_larb15_conf_pair[SMI_LARB15_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB16_CONF_NUM (3)
struct mtk_smi_pair smi_larb16_conf_pair[SMI_LARB16_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_FORCE_ULTRA, 0x8000},
{SMI_LARB_SW_FLAG, 0x1},
};
u32 smi_conf_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB15_CONF_NUM, SMI_LARB16_CONF_NUM, SMI_LARB16_CONF_NUM,
SMI_LARB16_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_DEV_NUM] = {
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb15_conf_pair, smi_larb16_conf_pair, smi_larb16_conf_pair,
smi_larb16_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_mdp_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sram_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sub_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x28},
{SMI_LARB_OSTDL_PORT(3), 0x28},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x18},
{SMI_LARB_OSTDL_PORT(2), 0xa},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x28},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x5},
{SMI_LARB_OSTDL_PORT(1), 0x5},
{SMI_LARB_OSTDL_PORT(2), 0x5},
{SMI_LARB_OSTDL_PORT(3), 0x5},
{SMI_LARB_OSTDL_PORT(4), 0x1},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = { };
struct mtk_smi_pair smi_larb4_init_pair[SMI_LARB4_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x19},
{SMI_LARB_OSTDL_PORT(2), 0xb},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x1},
{SMI_LARB_OSTDL_PORT(11), 0x16},
};
struct mtk_smi_pair smi_larb5_init_pair[SMI_LARB5_PORT_NUM] = { };
struct mtk_smi_pair smi_larb6_init_pair[SMI_LARB6_PORT_NUM] = { };
struct mtk_smi_pair smi_larb7_init_pair[SMI_LARB7_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x3},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x5},
{SMI_LARB_OSTDL_PORT(6), 0x2},
{SMI_LARB_OSTDL_PORT(7), 0x12},
{SMI_LARB_OSTDL_PORT(8), 0x13},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x4},
};
struct mtk_smi_pair smi_larb8_init_pair[SMI_LARB8_PORT_NUM] = { };
struct mtk_smi_pair smi_larb9_init_pair[SMI_LARB9_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xa},
{SMI_LARB_OSTDL_PORT(1), 0x7},
{SMI_LARB_OSTDL_PORT(2), 0xf},
{SMI_LARB_OSTDL_PORT(3), 0x8},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x8},
{SMI_LARB_OSTDL_PORT(6), 0x9},
{SMI_LARB_OSTDL_PORT(7), 0x3},
{SMI_LARB_OSTDL_PORT(8), 0x3},
{SMI_LARB_OSTDL_PORT(9), 0x6},
{SMI_LARB_OSTDL_PORT(10), 0x7},
{SMI_LARB_OSTDL_PORT(11), 0x4},
{SMI_LARB_OSTDL_PORT(12), 0xa},
{SMI_LARB_OSTDL_PORT(13), 0x3},
{SMI_LARB_OSTDL_PORT(14), 0x4},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x1},
{SMI_LARB_OSTDL_PORT(19), 0x1},
{SMI_LARB_OSTDL_PORT(20), 0x1},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x1},
{SMI_LARB_OSTDL_PORT(23), 0x1},
{SMI_LARB_OSTDL_PORT(24), 0x1},
{SMI_LARB_OSTDL_PORT(25), 0x1},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb10_init_pair[SMI_LARB10_PORT_NUM] = { };
struct mtk_smi_pair smi_larb11_init_pair[SMI_LARB11_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x1},
{SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x1},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x8},
{SMI_LARB_OSTDL_PORT(19), 0x7},
{SMI_LARB_OSTDL_PORT(20), 0x7},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x6},
{SMI_LARB_OSTDL_PORT(23), 0x2},
{SMI_LARB_OSTDL_PORT(24), 0xf},
{SMI_LARB_OSTDL_PORT(25), 0x8},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb12_init_pair[SMI_LARB12_PORT_NUM] = { };
struct mtk_smi_pair smi_larb13_init_pair[SMI_LARB13_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0xc},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x6},
{SMI_LARB_OSTDL_PORT(7), 0x6},
{SMI_LARB_OSTDL_PORT(8), 0x6},
{SMI_LARB_OSTDL_PORT(9), 0x12},
{SMI_LARB_OSTDL_PORT(10), 0x6},
{SMI_LARB_OSTDL_PORT(11), 0x1},
};
struct mtk_smi_pair smi_larb14_init_pair[SMI_LARB14_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x28},
{SMI_LARB_OSTDL_PORT(4), 0x12},
{SMI_LARB_OSTDL_PORT(5), 0x6},
};
struct mtk_smi_pair smi_larb15_init_pair[SMI_LARB15_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x28},
{SMI_LARB_OSTDL_PORT(4), 0x1},
};
struct mtk_smi_pair smi_larb16_init_pair[SMI_LARB16_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb17_init_pair[SMI_LARB17_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb18_init_pair[SMI_LARB18_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb19_init_pair[SMI_LARB19_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x4},
{SMI_LARB_OSTDL_PORT(3), 0x2},
};
struct mtk_smi_pair smi_larb20_init_pair[SMI_LARB20_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x9},
{SMI_LARB_OSTDL_PORT(1), 0x9},
{SMI_LARB_OSTDL_PORT(2), 0x5},
{SMI_LARB_OSTDL_PORT(3), 0x5},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
};
/* scen: ALL */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair,
};
struct mtk_smi_pair *smi_sub_comm_scen_pair[SMI_SCEN_NUM] = {
smi_sub_comm_init_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair,
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair,
};
struct mtk_smi_pair *smi_larb4_scen_pair[SMI_SCEN_NUM] = {
smi_larb4_init_pair,
};
struct mtk_smi_pair *smi_larb5_scen_pair[SMI_SCEN_NUM] = {
smi_larb5_init_pair,
};
struct mtk_smi_pair *smi_larb6_scen_pair[SMI_SCEN_NUM] = {
smi_larb6_init_pair,
};
struct mtk_smi_pair *smi_larb7_scen_pair[SMI_SCEN_NUM] = {
smi_larb7_init_pair,
};
struct mtk_smi_pair *smi_larb8_scen_pair[SMI_SCEN_NUM] = {
smi_larb8_init_pair,
};
struct mtk_smi_pair *smi_larb9_scen_pair[SMI_SCEN_NUM] = {
smi_larb9_init_pair,
};
struct mtk_smi_pair *smi_larb10_scen_pair[SMI_SCEN_NUM] = {
smi_larb10_init_pair,
};
struct mtk_smi_pair *smi_larb11_scen_pair[SMI_SCEN_NUM] = {
smi_larb11_init_pair,
};
struct mtk_smi_pair *smi_larb12_scen_pair[SMI_SCEN_NUM] = {
smi_larb12_init_pair,
};
struct mtk_smi_pair *smi_larb13_scen_pair[SMI_SCEN_NUM] = {
smi_larb13_init_pair,
};
struct mtk_smi_pair *smi_larb14_scen_pair[SMI_SCEN_NUM] = {
smi_larb14_init_pair,
};
struct mtk_smi_pair *smi_larb15_scen_pair[SMI_SCEN_NUM] = {
smi_larb15_init_pair,
};
struct mtk_smi_pair *smi_larb16_scen_pair[SMI_SCEN_NUM] = {
smi_larb16_init_pair,
};
struct mtk_smi_pair *smi_larb17_scen_pair[SMI_SCEN_NUM] = {
smi_larb17_init_pair,
};
struct mtk_smi_pair *smi_larb18_scen_pair[SMI_SCEN_NUM] = {
smi_larb18_init_pair,
};
struct mtk_smi_pair *smi_larb19_scen_pair[SMI_SCEN_NUM] = {
smi_larb19_init_pair,
};
struct mtk_smi_pair *smi_larb20_scen_pair[SMI_SCEN_NUM] = {
smi_larb20_init_pair,
};
u32 smi_scen_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_LARB4_PORT_NUM, SMI_LARB5_PORT_NUM,
SMI_LARB6_PORT_NUM, SMI_LARB7_PORT_NUM, SMI_LARB8_PORT_NUM,
SMI_LARB9_PORT_NUM,
SMI_LARB10_PORT_NUM, SMI_LARB11_PORT_NUM, SMI_LARB12_PORT_NUM,
SMI_LARB13_PORT_NUM, SMI_LARB14_PORT_NUM, SMI_LARB15_PORT_NUM,
SMI_LARB16_PORT_NUM, SMI_LARB17_PORT_NUM, SMI_LARB18_PORT_NUM,
SMI_LARB19_PORT_NUM, SMI_LARB20_PORT_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_DEV_NUM] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_larb4_scen_pair, smi_larb5_scen_pair,
smi_larb6_scen_pair, smi_larb7_scen_pair, smi_larb8_scen_pair,
smi_larb9_scen_pair,
smi_larb10_scen_pair, smi_larb11_scen_pair, smi_larb12_scen_pair,
smi_larb13_scen_pair, smi_larb14_scen_pair, smi_larb15_scen_pair,
smi_larb16_scen_pair, smi_larb17_scen_pair, smi_larb18_scen_pair,
smi_larb19_scen_pair, smi_larb20_scen_pair,
smi_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
};
#define SMI_RSI_DEBUG_NUM (29 * 2)
#define SMI_RSI_M0_OFFSET (0x1000)
#define SMI_RSI_M1_OFFSET (0x2000)
u32 smi_rsi_debug_offset[SMI_RSI_DEBUG_NUM] = {
SMI_RSI_M0_OFFSET + RSI_INTLV_CON,
SMI_RSI_M0_OFFSET + RSI_DCM_CON,
SMI_RSI_M0_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M0_OFFSET + RSI_MISC_CON,
SMI_RSI_M0_OFFSET + RSI_STA,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WOSTD_S,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_AROSTD_S,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M1,
SMI_RSI_M1_OFFSET + RSI_INTLV_CON,
SMI_RSI_M1_OFFSET + RSI_DCM_CON,
SMI_RSI_M1_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M1_OFFSET + RSI_MISC_CON,
SMI_RSI_M1_OFFSET + RSI_STA,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WOSTD_S,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_AROSTD_S,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M1,
};
#endif
+42
View File
@@ -0,0 +1,42 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6853-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_ISP] = (1 << 9) | (1 << 28),
[SYS_ISP2] = (1 << 11),
[SYS_IPE] = (1 << 19) | (1 << 20) | (1 << 25),
[SYS_VDE] = (1 << 4),
[SYS_VEN] = (1 << 7),
[SYS_DIS] = (1 << 0) | (1 << 1) | (1 << 2) |
(1 << 21) | (1 << 22) | (1 << 23) | (1 << 24),
[SYS_CAM] = (1 << 13) | (1 << 14) | (1 << 26) | (1 << 27),
[SYS_CAM_RAWA] = (1 << 16),
[SYS_CAM_RAWB] = (1 << 17),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_ISP] = "ISP",
[SYS_ISP2] = "ISP2",
[SYS_IPE] = "IPE",
[SYS_VDE] = "VDE",
[SYS_VEN] = "VEN",
[SYS_DIS] = "DIS",
[SYS_CAM] = "CAM",
[SYS_CAM_RAWA] = "CAM_RAWA",
[SYS_CAM_RAWB] = "CAM_RAWB",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,56 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#include <dt-bindings/memory/mt6853-larb-port.h>
#define SMI_OSTD_MAX (0x3f)
#define SMI_COMM_MASTER_NUM (8)
#define SMI_LARB_NUM (21)
#define SMI_LARB0_PORT_NUM (4) /* SYS_DIS */
#define SMI_LARB1_PORT_NUM (5) /* SYS_DIS */
#define SMI_LARB2_PORT_NUM (5) /* SYS_MDP */
#define SMI_LARB3_PORT_NUM (0)
#define SMI_LARB4_PORT_NUM (12) /* SYS_VDE */
#define SMI_LARB5_PORT_NUM (0)
#define SMI_LARB6_PORT_NUM (0)
#define SMI_LARB7_PORT_NUM (13) /* SYS_VEN */
#define SMI_LARB8_PORT_NUM (0)
#define SMI_LARB9_PORT_NUM (29) /* SYS_IMG1 */
#define SMI_LARB10_PORT_NUM (0) /* SYS_IMG1 */
#define SMI_LARB11_PORT_NUM (29) /* SYS_IMG2 */
#define SMI_LARB12_PORT_NUM (0) /* SYS_IMG2 */
#define SMI_LARB13_PORT_NUM (12) /* SYS_CAM1 */
#define SMI_LARB14_PORT_NUM (6) /* SYS_CAM1 */
#define SMI_LARB15_PORT_NUM (5) /* SYS_CAM1 */
#define SMI_LARB16_PORT_NUM (17) /* SYS_CAM2 */
#define SMI_LARB17_PORT_NUM (17) /* SYS_CAM3 */
#define SMI_LARB18_PORT_NUM (17) /* SYS_CAM4 */
#define SMI_LARB19_PORT_NUM (4) /* SYS_IPE */
#define SMI_LARB20_PORT_NUM (6) /* SYS_IPE */
#define SMI_COMM_NUM (1 + 7)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
#define SMI_LARB_CCU0 (13)
#define SMI_LARB_CCU1 (14)
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 1, 0, 1, 1, 0, 1,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 4, SMI_COMM_MASTER_NUM, 2, 2, SMI_COMM_MASTER_NUM,
3, SMI_COMM_MASTER_NUM, 5, SMI_COMM_MASTER_NUM, 5, SMI_COMM_MASTER_NUM,
7, 6, SMI_COMM_MASTER_NUM, 6, 7, 7, 5, 5};
static const u8
SMI_LARB_PORT_NUM[SMI_LARB_NUM] = {
4, 5, 5, 0, 12, 0, 0, 13, 0, 29, 0, 29, 0, 12, 6, 5, 17, 17, 17, 4, 6};
#endif
+488
View File
@@ -0,0 +1,488 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 1
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_ICFP (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{2, 3}, {2, 4}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{SMI_LARB0_PORT_NUM - 1, SMI_LARB0_PORT_NUM},
{SMI_LARB1_PORT_NUM - 1, SMI_LARB1_PORT_NUM},
{0, SMI_LARB2_PORT_NUM}, {0, 0},
{0, SMI_LARB4_PORT_NUM}, {0, SMI_LARB5_PORT_NUM}, {0, 0},
{0, SMI_LARB7_PORT_NUM}, {0, SMI_LARB8_PORT_NUM},
{0, SMI_LARB9_PORT_NUM}, {0, 0}, {0, SMI_LARB11_PORT_NUM}, {0, 0},
{SMI_LARB13_PORT_NUM - 1, SMI_LARB13_PORT_NUM}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0},
{0, SMI_LARB19_PORT_NUM}, {0, SMI_LARB20_PORT_NUM},
};
/* conf */
#define SMI_COMM_CONF_NUM (7)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_BUS_SEL, 0x1414}, {SMI_M4U_TH, 0xe100e10},
{SMI_FIFO_TH1, 0x90a090a}, {SMI_FIFO_TH2, 0x506090a},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_SUB_COMM_CONF_NUM (4)
struct mtk_smi_pair smi_sub_comm_conf_pair[SMI_SUB_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xa}, {SMI_PREULTRA_MASK1, 0x2105}, {SMI_DCM, 0x4f1},
{SMI_DUMMY, 0x1},
};
#define SMI_LARB0_CONF_NUM (4)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_WRR_PORT(2), 0x7}, {SMI_LARB_WRR_PORT(3), 0x7},
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB2_CONF_NUM (2)
struct mtk_smi_pair smi_larb2_conf_pair[SMI_LARB2_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB16_CONF_NUM (3)
struct mtk_smi_pair smi_larb16_conf_pair[SMI_LARB16_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_FORCE_ULTRA, 0x8000},
{SMI_LARB_SW_FLAG, 0x1},
};
u32 smi_conf_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB2_CONF_NUM,
SMI_LARB16_CONF_NUM, SMI_LARB16_CONF_NUM, SMI_LARB16_CONF_NUM,
SMI_LARB2_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_DEV_NUM] = {
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb2_conf_pair,
smi_larb2_conf_pair, smi_larb2_conf_pair, smi_larb2_conf_pair,
smi_larb2_conf_pair, smi_larb2_conf_pair, smi_larb2_conf_pair,
smi_larb2_conf_pair, smi_larb2_conf_pair, smi_larb2_conf_pair,
smi_larb2_conf_pair, smi_larb2_conf_pair, smi_larb2_conf_pair,
smi_larb2_conf_pair,
smi_larb16_conf_pair, smi_larb16_conf_pair, smi_larb16_conf_pair,
smi_larb2_conf_pair, smi_larb2_conf_pair,
smi_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sub_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x28},
{SMI_LARB_OSTDL_PORT(3), 0xa},
{SMI_LARB_OSTDL_PORT(4), 0xc},
{SMI_LARB_OSTDL_PORT(5), 0x28},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x18},
{SMI_LARB_OSTDL_PORT(3), 0x18},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0xa},
{SMI_LARB_OSTDL_PORT(6), 0xc},
{SMI_LARB_OSTDL_PORT(7), 0x28},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x5},
{SMI_LARB_OSTDL_PORT(1), 0x5},
{SMI_LARB_OSTDL_PORT(2), 0x5},
{SMI_LARB_OSTDL_PORT(3), 0x5},
{SMI_LARB_OSTDL_PORT(4), 0x1},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = { };
struct mtk_smi_pair smi_larb4_init_pair[SMI_LARB4_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x19},
{SMI_LARB_OSTDL_PORT(2), 0xb},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x1},
};
struct mtk_smi_pair smi_larb5_init_pair[SMI_LARB5_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x4},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x16},
};
struct mtk_smi_pair smi_larb6_init_pair[SMI_LARB6_PORT_NUM] = { };
struct mtk_smi_pair smi_larb7_init_pair[SMI_LARB7_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x3},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x5},
{SMI_LARB_OSTDL_PORT(6), 0x2},
{SMI_LARB_OSTDL_PORT(7), 0x12},
{SMI_LARB_OSTDL_PORT(8), 0x13},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x1},
};
struct mtk_smi_pair smi_larb8_init_pair[SMI_LARB8_PORT_NUM] = { };
struct mtk_smi_pair smi_larb9_init_pair[SMI_LARB9_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0xa},
{SMI_LARB_OSTDL_PORT(1), 0x7},
{SMI_LARB_OSTDL_PORT(2), 0xf},
{SMI_LARB_OSTDL_PORT(3), 0x8},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x8},
{SMI_LARB_OSTDL_PORT(6), 0x9},
{SMI_LARB_OSTDL_PORT(7), 0x3},
{SMI_LARB_OSTDL_PORT(8), 0x3},
{SMI_LARB_OSTDL_PORT(9), 0x6},
{SMI_LARB_OSTDL_PORT(10), 0x7},
{SMI_LARB_OSTDL_PORT(11), 0x4},
{SMI_LARB_OSTDL_PORT(12), 0xa},
{SMI_LARB_OSTDL_PORT(13), 0x3},
{SMI_LARB_OSTDL_PORT(14), 0x4},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x1},
{SMI_LARB_OSTDL_PORT(19), 0x1},
{SMI_LARB_OSTDL_PORT(20), 0x1},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x1},
{SMI_LARB_OSTDL_PORT(23), 0x1},
{SMI_LARB_OSTDL_PORT(24), 0x1},
{SMI_LARB_OSTDL_PORT(25), 0x1},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb10_init_pair[SMI_LARB10_PORT_NUM] = { };
struct mtk_smi_pair smi_larb11_init_pair[SMI_LARB11_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x1},
{SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x1},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x8},
{SMI_LARB_OSTDL_PORT(19), 0x7},
{SMI_LARB_OSTDL_PORT(20), 0x7},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x6},
{SMI_LARB_OSTDL_PORT(23), 0x2},
{SMI_LARB_OSTDL_PORT(24), 0xf},
{SMI_LARB_OSTDL_PORT(25), 0x8},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb12_init_pair[SMI_LARB12_PORT_NUM] = { };
struct mtk_smi_pair smi_larb13_init_pair[SMI_LARB13_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0xc},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0xe},
{SMI_LARB_OSTDL_PORT(4), 0x6},
{SMI_LARB_OSTDL_PORT(5), 0x6},
{SMI_LARB_OSTDL_PORT(6), 0x6},
{SMI_LARB_OSTDL_PORT(7), 0x6},
{SMI_LARB_OSTDL_PORT(8), 0x6},
{SMI_LARB_OSTDL_PORT(9), 0x12},
{SMI_LARB_OSTDL_PORT(10), 0x6},
{SMI_LARB_OSTDL_PORT(11), 0x28},
};
struct mtk_smi_pair smi_larb14_init_pair[SMI_LARB14_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0xc},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0x28},
{SMI_LARB_OSTDL_PORT(4), 0x12},
{SMI_LARB_OSTDL_PORT(5), 0x6},
};
struct mtk_smi_pair smi_larb15_init_pair[SMI_LARB15_PORT_NUM] = { };
struct mtk_smi_pair smi_larb16_init_pair[SMI_LARB16_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb17_init_pair[SMI_LARB17_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb18_init_pair[SMI_LARB18_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x28},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb19_init_pair[SMI_LARB19_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x4},
{SMI_LARB_OSTDL_PORT(3), 0x2},
};
struct mtk_smi_pair smi_larb20_init_pair[SMI_LARB20_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x9},
{SMI_LARB_OSTDL_PORT(1), 0x9},
{SMI_LARB_OSTDL_PORT(2), 0x5},
{SMI_LARB_OSTDL_PORT(3), 0x5},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
};
/* scen: ALL */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair,
};
struct mtk_smi_pair *smi_sub_comm_scen_pair[SMI_SCEN_NUM] = {
smi_sub_comm_init_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair,
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair,
};
struct mtk_smi_pair *smi_larb4_scen_pair[SMI_SCEN_NUM] = {
smi_larb4_init_pair,
};
struct mtk_smi_pair *smi_larb5_scen_pair[SMI_SCEN_NUM] = {
smi_larb5_init_pair,
};
struct mtk_smi_pair *smi_larb6_scen_pair[SMI_SCEN_NUM] = {
smi_larb6_init_pair,
};
struct mtk_smi_pair *smi_larb7_scen_pair[SMI_SCEN_NUM] = {
smi_larb7_init_pair,
};
struct mtk_smi_pair *smi_larb8_scen_pair[SMI_SCEN_NUM] = {
smi_larb8_init_pair,
};
struct mtk_smi_pair *smi_larb9_scen_pair[SMI_SCEN_NUM] = {
smi_larb9_init_pair,
};
struct mtk_smi_pair *smi_larb10_scen_pair[SMI_SCEN_NUM] = {
smi_larb10_init_pair,
};
struct mtk_smi_pair *smi_larb11_scen_pair[SMI_SCEN_NUM] = {
smi_larb11_init_pair,
};
struct mtk_smi_pair *smi_larb12_scen_pair[SMI_SCEN_NUM] = {
smi_larb12_init_pair,
};
struct mtk_smi_pair *smi_larb13_scen_pair[SMI_SCEN_NUM] = {
smi_larb13_init_pair,
};
struct mtk_smi_pair *smi_larb14_scen_pair[SMI_SCEN_NUM] = {
smi_larb14_init_pair,
};
struct mtk_smi_pair *smi_larb15_scen_pair[SMI_SCEN_NUM] = {
smi_larb15_init_pair,
};
struct mtk_smi_pair *smi_larb16_scen_pair[SMI_SCEN_NUM] = {
smi_larb16_init_pair,
};
struct mtk_smi_pair *smi_larb17_scen_pair[SMI_SCEN_NUM] = {
smi_larb17_init_pair,
};
struct mtk_smi_pair *smi_larb18_scen_pair[SMI_SCEN_NUM] = {
smi_larb18_init_pair,
};
struct mtk_smi_pair *smi_larb19_scen_pair[SMI_SCEN_NUM] = {
smi_larb19_init_pair,
};
struct mtk_smi_pair *smi_larb20_scen_pair[SMI_SCEN_NUM] = {
smi_larb20_init_pair,
};
u32 smi_scen_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_LARB4_PORT_NUM, SMI_LARB5_PORT_NUM,
SMI_LARB6_PORT_NUM, SMI_LARB7_PORT_NUM, SMI_LARB8_PORT_NUM,
SMI_LARB9_PORT_NUM,
SMI_LARB10_PORT_NUM, SMI_LARB11_PORT_NUM, SMI_LARB12_PORT_NUM,
SMI_LARB13_PORT_NUM, SMI_LARB14_PORT_NUM, SMI_LARB15_PORT_NUM,
SMI_LARB16_PORT_NUM, SMI_LARB17_PORT_NUM, SMI_LARB18_PORT_NUM,
SMI_LARB19_PORT_NUM, SMI_LARB20_PORT_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_DEV_NUM] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_larb4_scen_pair, smi_larb5_scen_pair,
smi_larb6_scen_pair, smi_larb7_scen_pair, smi_larb8_scen_pair,
smi_larb9_scen_pair, smi_larb10_scen_pair, smi_larb11_scen_pair,
smi_larb12_scen_pair, smi_larb13_scen_pair, smi_larb14_scen_pair,
smi_larb15_scen_pair, smi_larb16_scen_pair, smi_larb17_scen_pair,
smi_larb18_scen_pair, smi_larb19_scen_pair, smi_larb20_scen_pair,
smi_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
};
#endif
+47
View File
@@ -0,0 +1,47 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6873-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_ISP] = (1 << 9),
[SYS_ISP2] = (1 << 11),
[SYS_IPE] = (1 << 19) | (1 << 20) | (1 << 29),
[SYS_VDE] = (1 << 5) | (1 << 26),
[SYS_VDE2] = (1 << 4),
[SYS_VEN] = (1 << 7),
[SYS_MDP] = (1 << 2),
[SYS_DIS] = (1 << 0) | (1 << 1) |
(1 << 21) | (1 << 22) | (1 << 23) | (1 << 24) | (1 << 25),
[SYS_CAM] = (1 << 13) | (1 << 14) | (1 << 27) | (1 << 28),
[SYS_CAM_RAWA] = (1 << 16),
[SYS_CAM_RAWB] = (1 << 17),
[SYS_CAM_RAWC] = (1 << 18),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_ISP] = "ISP",
[SYS_ISP2] = "ISP2",
[SYS_IPE] = "IPE",
[SYS_VDE] = "VDE",
[SYS_VDE2] = "VDE2",
[SYS_VEN] = "VEN",
[SYS_MDP] = "MDP",
[SYS_DIS] = "DIS",
[SYS_CAM] = "CAM",
[SYS_CAM_RAWA] = "CAM_RAWA",
[SYS_CAM_RAWB] = "CAM_RAWB",
[SYS_CAM_RAWC] = "CAM_RAWC",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#include <dt-bindings/memory/mt6873-larb-port.h>
#define SMI_OSTD_MAX (0x3f)
#define SMI_COMM_MASTER_NUM (8)
#define SMI_LARB_NUM (21)
#define SMI_LARB0_PORT_NUM (6) /* SYS_DIS */
#define SMI_LARB1_PORT_NUM (8) /* SYS_DIS */
#define SMI_LARB2_PORT_NUM (5) /* SYS_MDP */
#define SMI_LARB3_PORT_NUM (0) /* SYS_MDP */
#define SMI_LARB4_PORT_NUM (11) /* SYS_VDE */
#define SMI_LARB5_PORT_NUM (8) /* SYS_VDE */
#define SMI_LARB6_PORT_NUM (0) /* SYS_VDE */
#define SMI_LARB7_PORT_NUM (15) /* SYS_VEN */
#define SMI_LARB8_PORT_NUM (0) /* SYS_VEN */
#define SMI_LARB9_PORT_NUM (29) /* SYS_IMG1 */
#define SMI_LARB10_PORT_NUM (0) /* SYS_IMG1 */
#define SMI_LARB11_PORT_NUM (29) /* SYS_IMG2 */
#define SMI_LARB12_PORT_NUM (0) /* SYS_IMG2 */
#define SMI_LARB13_PORT_NUM (12) /* SYS_CAM1 */
#define SMI_LARB14_PORT_NUM (6) /* SYS_CAM1 */
#define SMI_LARB15_PORT_NUM (0) /* SYS_CAM1 */
#define SMI_LARB16_PORT_NUM (17) /* SYS_CAM2 */
#define SMI_LARB17_PORT_NUM (17) /* SYS_CAM3 */
#define SMI_LARB18_PORT_NUM (17) /* SYS_CAM4 */
#define SMI_LARB19_PORT_NUM (4) /* SYS_IPE */
#define SMI_LARB20_PORT_NUM (6) /* SYS_IPE */
#define SMI_COMM_NUM (1 + 8)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
#define SMI_LARB_CCU0 (13)
#define SMI_LARB_CCU1 (14)
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 1, 0, 1, 1, 0, 1,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 4, SMI_COMM_MASTER_NUM, 2, 2, SMI_COMM_MASTER_NUM,
3, SMI_COMM_MASTER_NUM, 5, SMI_COMM_MASTER_NUM, 5, SMI_COMM_MASTER_NUM,
7, 6, SMI_COMM_MASTER_NUM, 6, 7, 7, 5, 5};
static const u8
SMI_LARB_PORT_NUM[SMI_LARB_NUM] = {
6, 8, 5, 0, 11, 8, 0, 15, 0, 29, 0, 29, 0, 12, 6, 0, 17, 17, 17, 4, 6};
#endif
+538
View File
@@ -0,0 +1,538 @@
//* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 1
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_ICFP (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = { /* ovl with large ostd */
{2, 3}, {1, 2}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{SMI_LARB0_PORT_NUM - 1, SMI_LARB0_PORT_NUM}, {4, 5},
{0, SMI_LARB2_PORT_NUM}, {0, 0},
{0, SMI_LARB4_PORT_NUM}, {0, 0}, {0, 0},
{0, SMI_LARB7_PORT_NUM}, {0, 0},
{0, SMI_LARB9_PORT_NUM}, {0, 0}, {0, SMI_LARB11_PORT_NUM}, {0, 0},
{11, 12}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, SMI_LARB19_PORT_NUM}, {0, SMI_LARB20_PORT_NUM},
};
/* conf */
#define SMI_COMM_CONF_NUM (7)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_BUS_SEL, 0x1414}, {SMI_M4U_TH, 0xe100e10},
{SMI_FIFO_TH1, 0x90a090a}, {SMI_FIFO_TH2, 0x506090a},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_SUB_COMM_CONF_NUM (4)
struct mtk_smi_pair smi_sub_comm_conf_pair[SMI_SUB_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xa}, {SMI_PREULTRA_MASK1, 0x2105},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_LARB0_CONF_NUM (2)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB15_CONF_NUM (2)
struct mtk_smi_pair smi_larb15_conf_pair[SMI_LARB15_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB16_CONF_NUM (3)
struct mtk_smi_pair smi_larb16_conf_pair[SMI_LARB16_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_FORCE_ULTRA, 0x8000},
{SMI_LARB_SW_FLAG, 0x1},
};
u32 smi_conf_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_LARB15_CONF_NUM, SMI_LARB16_CONF_NUM, SMI_LARB16_CONF_NUM,
SMI_LARB16_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM,
SMI_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_DEV_NUM] = {
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_larb15_conf_pair, smi_larb16_conf_pair, smi_larb16_conf_pair,
smi_larb16_conf_pair, smi_larb0_conf_pair, smi_larb0_conf_pair,
smi_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_mdp_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sram_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sub_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x30},
{SMI_LARB_OSTDL_PORT(3), 0x6},
{SMI_LARB_OSTDL_PORT(4), 0x30},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x18},
{SMI_LARB_OSTDL_PORT(2), 0x8},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x28},
{SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x18},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x1},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = { };
struct mtk_smi_pair smi_larb4_init_pair[SMI_LARB4_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x35},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x9},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x3},
{SMI_LARB_OSTDL_PORT(10), 0x11},
{SMI_LARB_OSTDL_PORT(11), 0x1},
};
struct mtk_smi_pair smi_larb5_init_pair[SMI_LARB5_PORT_NUM] = { };
struct mtk_smi_pair smi_larb6_init_pair[SMI_LARB6_PORT_NUM] = { };
struct mtk_smi_pair smi_larb7_init_pair[SMI_LARB7_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x3},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x4},
{SMI_LARB_OSTDL_PORT(7), 0x4},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x3},
{SMI_LARB_OSTDL_PORT(10), 0x2},
{SMI_LARB_OSTDL_PORT(11), 0x4},
{SMI_LARB_OSTDL_PORT(12), 0x2},
{SMI_LARB_OSTDL_PORT(13), 0xf},
{SMI_LARB_OSTDL_PORT(14), 0x10},
};
struct mtk_smi_pair smi_larb8_init_pair[SMI_LARB8_PORT_NUM] = { };
struct mtk_smi_pair smi_larb9_init_pair[SMI_LARB9_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x6},
{SMI_LARB_OSTDL_PORT(1), 0x3},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0x6},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0x4},
{SMI_LARB_OSTDL_PORT(7), 0x2},
{SMI_LARB_OSTDL_PORT(8), 0x2},
{SMI_LARB_OSTDL_PORT(9), 0x5},
{SMI_LARB_OSTDL_PORT(10), 0x5},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x6},
{SMI_LARB_OSTDL_PORT(13), 0x3},
{SMI_LARB_OSTDL_PORT(14), 0x3},
{SMI_LARB_OSTDL_PORT(15), 0xb},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x6},
{SMI_LARB_OSTDL_PORT(18), 0x1},
{SMI_LARB_OSTDL_PORT(19), 0x1},
{SMI_LARB_OSTDL_PORT(20), 0x1},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x1},
{SMI_LARB_OSTDL_PORT(23), 0x1},
{SMI_LARB_OSTDL_PORT(24), 0x1},
{SMI_LARB_OSTDL_PORT(25), 0x1},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb10_init_pair[SMI_LARB10_PORT_NUM] = { };
struct mtk_smi_pair smi_larb11_init_pair[SMI_LARB11_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x1},
{SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x1},
{SMI_LARB_OSTDL_PORT(15), 0xb},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x6},
{SMI_LARB_OSTDL_PORT(18), 0x6},
{SMI_LARB_OSTDL_PORT(19), 0x5},
{SMI_LARB_OSTDL_PORT(20), 0x6},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x5},
{SMI_LARB_OSTDL_PORT(23), 0x2},
{SMI_LARB_OSTDL_PORT(24), 0xc},
{SMI_LARB_OSTDL_PORT(25), 0x6},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb12_init_pair[SMI_LARB12_PORT_NUM] = { };
struct mtk_smi_pair smi_larb13_init_pair[SMI_LARB13_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0xa},
{SMI_LARB_OSTDL_PORT(2), 0xa},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x6},
{SMI_LARB_OSTDL_PORT(5), 0x6},
{SMI_LARB_OSTDL_PORT(6), 0x6},
{SMI_LARB_OSTDL_PORT(7), 0x6},
{SMI_LARB_OSTDL_PORT(8), 0x6},
{SMI_LARB_OSTDL_PORT(9), 0xe},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x6},
{SMI_LARB_OSTDL_PORT(13), 0x6},
{SMI_LARB_OSTDL_PORT(14), 0x2},
};
struct mtk_smi_pair smi_larb14_init_pair[SMI_LARB14_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x2a},
{SMI_LARB_OSTDL_PORT(4), 0xe},
{SMI_LARB_OSTDL_PORT(5), 0x4},
{SMI_LARB_OSTDL_PORT(6), 0xc},
{SMI_LARB_OSTDL_PORT(7), 0xc},
{SMI_LARB_OSTDL_PORT(8), 0x6},
{SMI_LARB_OSTDL_PORT(9), 0x6},
};
struct mtk_smi_pair smi_larb15_init_pair[SMI_LARB15_PORT_NUM] = { };
struct mtk_smi_pair smi_larb16_init_pair[SMI_LARB16_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x10},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x8},
{SMI_LARB_OSTDL_PORT(4), 0x14},
{SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x1e},
{SMI_LARB_OSTDL_PORT(7), 0x10},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x6},
{SMI_LARB_OSTDL_PORT(15), 0x2},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb17_init_pair[SMI_LARB17_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x10},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x8},
{SMI_LARB_OSTDL_PORT(4), 0x14},
{SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x1e},
{SMI_LARB_OSTDL_PORT(7), 0x10},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x2},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x6},
{SMI_LARB_OSTDL_PORT(15), 0x2},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb18_init_pair[SMI_LARB18_PORT_NUM] = { };
struct mtk_smi_pair smi_larb19_init_pair[SMI_LARB19_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x3},
{SMI_LARB_OSTDL_PORT(3), 0x2},
};
struct mtk_smi_pair smi_larb20_init_pair[SMI_LARB20_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x7},
{SMI_LARB_OSTDL_PORT(1), 0x7},
{SMI_LARB_OSTDL_PORT(2), 0x4},
{SMI_LARB_OSTDL_PORT(3), 0x4},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
};
/* scen: ALL */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair,
};
struct mtk_smi_pair *smi_sub_comm_scen_pair[SMI_SCEN_NUM] = {
smi_sub_comm_init_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair,
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair,
};
struct mtk_smi_pair *smi_larb4_scen_pair[SMI_SCEN_NUM] = {
smi_larb4_init_pair,
};
struct mtk_smi_pair *smi_larb5_scen_pair[SMI_SCEN_NUM] = {
smi_larb5_init_pair,
};
struct mtk_smi_pair *smi_larb6_scen_pair[SMI_SCEN_NUM] = {
smi_larb6_init_pair,
};
struct mtk_smi_pair *smi_larb7_scen_pair[SMI_SCEN_NUM] = {
smi_larb7_init_pair,
};
struct mtk_smi_pair *smi_larb8_scen_pair[SMI_SCEN_NUM] = {
smi_larb8_init_pair,
};
struct mtk_smi_pair *smi_larb9_scen_pair[SMI_SCEN_NUM] = {
smi_larb9_init_pair,
};
struct mtk_smi_pair *smi_larb10_scen_pair[SMI_SCEN_NUM] = {
smi_larb10_init_pair,
};
struct mtk_smi_pair *smi_larb11_scen_pair[SMI_SCEN_NUM] = {
smi_larb11_init_pair,
};
struct mtk_smi_pair *smi_larb12_scen_pair[SMI_SCEN_NUM] = {
smi_larb12_init_pair,
};
struct mtk_smi_pair *smi_larb13_scen_pair[SMI_SCEN_NUM] = {
smi_larb13_init_pair,
};
struct mtk_smi_pair *smi_larb14_scen_pair[SMI_SCEN_NUM] = {
smi_larb14_init_pair,
};
struct mtk_smi_pair *smi_larb15_scen_pair[SMI_SCEN_NUM] = {
smi_larb15_init_pair,
};
struct mtk_smi_pair *smi_larb16_scen_pair[SMI_SCEN_NUM] = {
smi_larb16_init_pair,
};
struct mtk_smi_pair *smi_larb17_scen_pair[SMI_SCEN_NUM] = {
smi_larb17_init_pair,
};
struct mtk_smi_pair *smi_larb18_scen_pair[SMI_SCEN_NUM] = {
smi_larb18_init_pair,
};
struct mtk_smi_pair *smi_larb19_scen_pair[SMI_SCEN_NUM] = {
smi_larb19_init_pair,
};
struct mtk_smi_pair *smi_larb20_scen_pair[SMI_SCEN_NUM] = {
smi_larb20_init_pair,
};
u32 smi_scen_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_LARB4_PORT_NUM, SMI_LARB5_PORT_NUM,
SMI_LARB6_PORT_NUM, SMI_LARB7_PORT_NUM, SMI_LARB8_PORT_NUM,
SMI_LARB9_PORT_NUM,
SMI_LARB10_PORT_NUM, SMI_LARB11_PORT_NUM, SMI_LARB12_PORT_NUM,
SMI_LARB13_PORT_NUM, SMI_LARB14_PORT_NUM, SMI_LARB15_PORT_NUM,
SMI_LARB16_PORT_NUM, SMI_LARB17_PORT_NUM, SMI_LARB18_PORT_NUM,
SMI_LARB19_PORT_NUM, SMI_LARB20_PORT_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_DEV_NUM] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_larb4_scen_pair, smi_larb5_scen_pair,
smi_larb6_scen_pair, smi_larb7_scen_pair, smi_larb8_scen_pair,
smi_larb9_scen_pair,
smi_larb10_scen_pair, smi_larb11_scen_pair, smi_larb12_scen_pair,
smi_larb13_scen_pair, smi_larb14_scen_pair, smi_larb15_scen_pair,
smi_larb16_scen_pair, smi_larb17_scen_pair, smi_larb18_scen_pair,
smi_larb19_scen_pair, smi_larb20_scen_pair,
smi_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
};
#define SMI_RSI_DEBUG_NUM (29 * 2)
#define SMI_RSI_M0_OFFSET (0x1000)
#define SMI_RSI_M1_OFFSET (0x2000)
u32 smi_rsi_debug_offset[SMI_RSI_DEBUG_NUM] = {
SMI_RSI_M0_OFFSET + RSI_INTLV_CON,
SMI_RSI_M0_OFFSET + RSI_DCM_CON,
SMI_RSI_M0_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M0_OFFSET + RSI_MISC_CON,
SMI_RSI_M0_OFFSET + RSI_STA,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WOSTD_S,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_AROSTD_S,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M1,
SMI_RSI_M1_OFFSET + RSI_INTLV_CON,
SMI_RSI_M1_OFFSET + RSI_DCM_CON,
SMI_RSI_M1_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M1_OFFSET + RSI_MISC_CON,
SMI_RSI_M1_OFFSET + RSI_STA,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WOSTD_S,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_AROSTD_S,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M1,
};
#endif
+44
View File
@@ -0,0 +1,44 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6877-pg.h>
#include <smi_port.h>
#define SYS_DIS SYS_DISP /* Because smi_drv.c use SYS_DIS */
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_ISP0] = (1 << 9) | (1 << 24),
[SYS_ISP1] = (1 << 11),
[SYS_IPE] = (1 << 19) | (1 << 20) | (1 << 26),
[SYS_VDEC] = (1 << 4),
[SYS_VENC] = (1 << 7),
[SYS_DISP] = (1 << 0) | (1 << 1) | (1 << 2) |
(1 << 21) | (1 << 22) | (1 << 23) | (1 << 25),
[SYS_CAM] = (1 << 13) | (1 << 14) | (1 << 27) | (1 << 28),
[SYS_CAM_RAWA] = (1 << 16),
[SYS_CAM_RAWB] = (1 << 17),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_ISP0] = "ISP0",
[SYS_ISP1] = "ISP1",
[SYS_IPE] = "IPE",
[SYS_VDEC] = "VDEC",
[SYS_VENC] = "VENC",
[SYS_DISP] = "DISP",
[SYS_CAM] = "CAM",
[SYS_CAM_RAWA] = "CAM_RAWA",
[SYS_CAM_RAWB] = "CAM_RAWB",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,54 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#include <dt-bindings/memory/mt6877-larb-port.h>
#define SMI_OSTD_MAX (0x3f)
#define SMI_COMM_MASTER_NUM (8)
#define SMI_LARB_NUM (21)
#define SMI_LARB0_PORT_NUM (5) /* SYS_DIS */
#define SMI_LARB1_PORT_NUM (7) /* SYS_DIS */
#define SMI_LARB2_PORT_NUM (5) /* SYS_MDP */
#define SMI_LARB3_PORT_NUM (0)
#define SMI_LARB4_PORT_NUM (12) /* SYS_VDE */
#define SMI_LARB5_PORT_NUM (0)
#define SMI_LARB6_PORT_NUM (0)
#define SMI_LARB7_PORT_NUM (15) /* SYS_VEN */
#define SMI_LARB8_PORT_NUM (0)
#define SMI_LARB9_PORT_NUM (29) /* SYS_IMG1 */
#define SMI_LARB10_PORT_NUM (0)
#define SMI_LARB11_PORT_NUM (29) /* SYS_IMG2 */
#define SMI_LARB12_PORT_NUM (0)
#define SMI_LARB13_PORT_NUM (15) /* SYS_CAM1 */
#define SMI_LARB14_PORT_NUM (10) /* SYS_CAM1 */
#define SMI_LARB15_PORT_NUM (0)
#define SMI_LARB16_PORT_NUM (17) /* SYS_CAM2 */
#define SMI_LARB17_PORT_NUM (17) /* SYS_CAM3 */
#define SMI_LARB18_PORT_NUM (0)
#define SMI_LARB19_PORT_NUM (4) /* SYS_IPE */
#define SMI_LARB20_PORT_NUM (6) /* SYS_IPE */
#define SMI_COMM_NUM (1 + 7) /* include sub_common */
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 1, 0, 0, 1, 1, 0,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 4, SMI_COMM_MASTER_NUM, 2, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, 3, SMI_COMM_MASTER_NUM, 5, SMI_COMM_MASTER_NUM,
5, SMI_COMM_MASTER_NUM, 7, 6, SMI_COMM_MASTER_NUM, 6, 7,
SMI_COMM_MASTER_NUM, 5, 5};
static const u8
SMI_LARB_PORT_NUM[SMI_LARB_NUM] = {
5, 7, 5, 0, 12, 0, 0, 15, 0, 29, 0, 29, 0, 15, 10, 0, 17, 17, 0, 4, 6};
#endif
+678
View File
@@ -0,0 +1,678 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_CONF_H__
#define __SMI_CONF_H__
#include <soc/mediatek/smi.h>
#include "smi_hw.h"
#include "../smi_reg.h"
#include "../smi_conf_dbg.h"
#define SMI_SCEN_NUM 1
#define SMI_ESL_INIT 0
#define SMI_ESL_VPWFD (SMI_ESL_INIT)
#define SMI_ESL_ICFP (SMI_ESL_INIT)
#define SMI_ESL_VR4K (SMI_ESL_INIT)
static u32 smi_scen_map[SMI_BWC_SCEN_CNT] = {
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_INIT, SMI_ESL_INIT, SMI_ESL_INIT,
SMI_ESL_VPWFD, SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VPWFD, SMI_ESL_VPWFD,
SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K, SMI_ESL_VR4K,
SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_ICFP, SMI_ESL_INIT
};
static u32 smi_larb_cmd_gp_en_port[SMI_LARB_NUM][2] = {
{5, 8}, {5, 8}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
};
static u32 smi_larb_bw_thrt_en_port[SMI_LARB_NUM][2] = { /* non-HRT */
{SMI_LARB0_PORT_NUM - 1, SMI_LARB0_PORT_NUM},
{SMI_LARB1_PORT_NUM - 1, SMI_LARB1_PORT_NUM},
{0, SMI_LARB2_PORT_NUM}, {0, SMI_LARB3_PORT_NUM},
{0, SMI_LARB4_PORT_NUM}, {0, SMI_LARB5_PORT_NUM}, {0, 0},
{0, SMI_LARB7_PORT_NUM}, {0, SMI_LARB8_PORT_NUM},
{0, SMI_LARB9_PORT_NUM}, {0, 0}, {0, SMI_LARB11_PORT_NUM}, {0, 0},
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
{0, SMI_LARB19_PORT_NUM}, {0, SMI_LARB20_PORT_NUM},
};
/* conf */
#define SMI_COMM_CONF_NUM (7)
struct mtk_smi_pair smi_comm_conf_pair[SMI_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xb}, {SMI_BUS_SEL, 0x4514}, {SMI_M4U_TH, 0xe100e10},
{SMI_FIFO_TH1, 0x506090a}, {SMI_FIFO_TH2, 0x506090a},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_SRAM_COMM_CONF_NUM (4)
struct mtk_smi_pair smi_sram_comm_conf_pair[SMI_SRAM_COMM_CONF_NUM] = {
{SMI_L1LEN, 0x2}, {SMI_BUS_SEL, 0x1111},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_SUB_COMM_CONF_NUM (4)
struct mtk_smi_pair smi_sub_comm_conf_pair[SMI_SUB_COMM_CONF_NUM] = {
{SMI_L1LEN, 0xa}, {SMI_PREULTRA_MASK1, 0x2105},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_IPE_SUB_COMM_CONF_NUM (4)
struct mtk_smi_pair smi_ipe_sub_comm_conf_pair[SMI_IPE_SUB_COMM_CONF_NUM] = {
{SMI_L1LEN, 0x2}, {SMI_PREULTRA_MASK1, 0x2105},
{SMI_DCM, 0x4f1}, {SMI_DUMMY, 0x1},
};
#define SMI_LARB0_CONF_NUM (7)
struct mtk_smi_pair smi_larb0_conf_pair[SMI_LARB0_CONF_NUM] = {
{SMI_LARB_VC_PRI_MODE, 0x1},
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_WRR_PORT(5), 0x7}, {SMI_LARB_WRR_PORT(6), 0x7},
{SMI_LARB_WRR_PORT(7), 0x7}, {INT_SMI_LARB_CMD_THRT_CON, 0x370256},
};
#define SMI_LARB2_CONF_NUM (3)
struct mtk_smi_pair smi_larb2_conf_pair[SMI_LARB2_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
{INT_SMI_LARB_CMD_THRT_CON, 0x370256},
};
#define SMI_LARB4_CONF_NUM (2)
struct mtk_smi_pair smi_larb4_conf_pair[SMI_LARB4_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
};
#define SMI_LARB6_CONF_NUM (0)
struct mtk_smi_pair smi_larb6_conf_pair[SMI_LARB6_CONF_NUM] = { };
#define SMI_LARB7_CONF_NUM (3)
struct mtk_smi_pair smi_larb7_conf_pair[SMI_LARB7_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x300256}, {SMI_LARB_SW_FLAG, 0x1},
{INT_SMI_LARB_CMD_THRT_CON, 0x300256},
};
#define SMI_LARB13_CONF_NUM (5)
struct mtk_smi_pair smi_larb13_conf_pair[SMI_LARB13_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_DBG_CON, 0x1}, {INT_SMI_LARB_CMD_THRT_CON, 0x370256},
{INT_SMI_LARB_DBG_CON, 0x1},
};
#define SMI_LARB16_CONF_NUM (4)
struct mtk_smi_pair smi_larb16_conf_pair[SMI_LARB16_CONF_NUM] = {
{SMI_LARB_CMD_THRT_CON, 0x370256}, {SMI_LARB_SW_FLAG, 0x1},
{SMI_LARB_FORCE_ULTRA, 0x8000}, {INT_SMI_LARB_CMD_THRT_CON, 0x370256},
};
u32 smi_conf_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_CONF_NUM, SMI_LARB0_CONF_NUM, SMI_LARB2_CONF_NUM,
SMI_LARB2_CONF_NUM, SMI_LARB4_CONF_NUM, SMI_LARB4_CONF_NUM,
SMI_LARB6_CONF_NUM, SMI_LARB7_CONF_NUM, SMI_LARB7_CONF_NUM,
SMI_LARB4_CONF_NUM, SMI_LARB6_CONF_NUM, SMI_LARB4_CONF_NUM,
SMI_LARB6_CONF_NUM, SMI_LARB13_CONF_NUM, SMI_LARB13_CONF_NUM,
SMI_LARB4_CONF_NUM, SMI_LARB16_CONF_NUM, SMI_LARB16_CONF_NUM,
SMI_LARB16_CONF_NUM, SMI_LARB4_CONF_NUM, SMI_LARB4_CONF_NUM,
SMI_COMM_CONF_NUM, SMI_COMM_CONF_NUM, SMI_SRAM_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_IPE_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
SMI_SUB_COMM_CONF_NUM, SMI_SUB_COMM_CONF_NUM,
};
struct mtk_smi_pair *smi_conf_pair[SMI_DEV_NUM] = {
smi_larb0_conf_pair, smi_larb0_conf_pair, smi_larb2_conf_pair,
smi_larb2_conf_pair, smi_larb4_conf_pair, smi_larb4_conf_pair,
smi_larb6_conf_pair, smi_larb7_conf_pair, smi_larb7_conf_pair,
smi_larb4_conf_pair, smi_larb6_conf_pair, smi_larb4_conf_pair,
smi_larb6_conf_pair, smi_larb13_conf_pair, smi_larb13_conf_pair,
smi_larb4_conf_pair, smi_larb16_conf_pair, smi_larb16_conf_pair,
smi_larb16_conf_pair, smi_larb4_conf_pair, smi_larb4_conf_pair,
smi_comm_conf_pair, smi_comm_conf_pair, smi_sram_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_ipe_sub_comm_conf_pair,
smi_sub_comm_conf_pair, smi_sub_comm_conf_pair, smi_sub_comm_conf_pair,
};
/* scen: INIT */
struct mtk_smi_pair smi_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_mdp_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sram_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_sub_comm_init_pair[SMI_COMM_MASTER_NUM] = {
{SMI_L1ARB(0), 0x0}, {SMI_L1ARB(1), 0x0}, {SMI_L1ARB(2), 0x0},
{SMI_L1ARB(3), 0x0}, {SMI_L1ARB(4), 0x0}, {SMI_L1ARB(5), 0x0},
{SMI_L1ARB(6), 0x0}, {SMI_L1ARB(7), 0x0},
};
struct mtk_smi_pair smi_larb0_init_pair[SMI_LARB0_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x6},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2},
{SMI_LARB_OSTDL_PORT(5), 0x28},
{SMI_LARB_OSTDL_PORT(6), 0x18},
{SMI_LARB_OSTDL_PORT(7), 0x18},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1},
{SMI_LARB_OSTDL_PORT(11), 0x8},
{SMI_LARB_OSTDL_PORT(12), 0x8},
{SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x3f},
};
struct mtk_smi_pair smi_larb1_init_pair[SMI_LARB1_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x6},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x2},
{SMI_LARB_OSTDL_PORT(4), 0x2},
{SMI_LARB_OSTDL_PORT(5), 0x28},
{SMI_LARB_OSTDL_PORT(6), 0x18},
{SMI_LARB_OSTDL_PORT(7), 0x18},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x1},
{SMI_LARB_OSTDL_PORT(10), 0x1},
{SMI_LARB_OSTDL_PORT(11), 0x8},
{SMI_LARB_OSTDL_PORT(12), 0x8},
{SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0x3f},
};
struct mtk_smi_pair smi_larb2_init_pair[SMI_LARB2_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x5},
{SMI_LARB_OSTDL_PORT(1), 0x5},
{SMI_LARB_OSTDL_PORT(2), 0x5},
{SMI_LARB_OSTDL_PORT(3), 0x5},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x3f},
};
struct mtk_smi_pair smi_larb3_init_pair[SMI_LARB3_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x5},
{SMI_LARB_OSTDL_PORT(1), 0x5},
{SMI_LARB_OSTDL_PORT(2), 0x5},
{SMI_LARB_OSTDL_PORT(3), 0x5},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x3f},
};
struct mtk_smi_pair smi_larb4_init_pair[SMI_LARB4_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x19},
{SMI_LARB_OSTDL_PORT(2), 0xb},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x1},
};
struct mtk_smi_pair smi_larb5_init_pair[SMI_LARB5_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x4},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x16},
};
struct mtk_smi_pair smi_larb6_init_pair[SMI_LARB6_PORT_NUM] = { };
struct mtk_smi_pair smi_larb7_init_pair[SMI_LARB7_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x4},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0xa},
{SMI_LARB_OSTDL_PORT(15), 0x6},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0xa},
{SMI_LARB_OSTDL_PORT(18), 0x6},
{SMI_LARB_OSTDL_PORT(19), 0x1},
{SMI_LARB_OSTDL_PORT(20), 0x1},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x1},
{SMI_LARB_OSTDL_PORT(23), 0x5},
{SMI_LARB_OSTDL_PORT(24), 0x3},
{SMI_LARB_OSTDL_PORT(25), 0x3},
{SMI_LARB_OSTDL_PORT(26), 0x4},
};
struct mtk_smi_pair smi_larb8_init_pair[SMI_LARB8_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x1},
{SMI_LARB_OSTDL_PORT(1), 0x4},
{SMI_LARB_OSTDL_PORT(2), 0x1},
{SMI_LARB_OSTDL_PORT(3), 0x1},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
{SMI_LARB_OSTDL_PORT(6), 0x1},
{SMI_LARB_OSTDL_PORT(7), 0x1},
{SMI_LARB_OSTDL_PORT(8), 0x1},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x1},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x1},
{SMI_LARB_OSTDL_PORT(14), 0xa},
{SMI_LARB_OSTDL_PORT(15), 0x6},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0xa},
{SMI_LARB_OSTDL_PORT(18), 0x6},
{SMI_LARB_OSTDL_PORT(19), 0x1},
{SMI_LARB_OSTDL_PORT(20), 0x1},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x1},
{SMI_LARB_OSTDL_PORT(23), 0x5},
{SMI_LARB_OSTDL_PORT(24), 0x3},
{SMI_LARB_OSTDL_PORT(25), 0x3},
{SMI_LARB_OSTDL_PORT(26), 0x4},
};
struct mtk_smi_pair smi_larb9_init_pair[SMI_LARB9_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x9},
{SMI_LARB_OSTDL_PORT(1), 0x7},
{SMI_LARB_OSTDL_PORT(2), 0xf},
{SMI_LARB_OSTDL_PORT(3), 0x8},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x8},
{SMI_LARB_OSTDL_PORT(6), 0x9},
{SMI_LARB_OSTDL_PORT(7), 0x3},
{SMI_LARB_OSTDL_PORT(8), 0x3},
{SMI_LARB_OSTDL_PORT(9), 0x6},
{SMI_LARB_OSTDL_PORT(10), 0x7},
{SMI_LARB_OSTDL_PORT(11), 0x4},
{SMI_LARB_OSTDL_PORT(12), 0x9},
{SMI_LARB_OSTDL_PORT(13), 0x3},
{SMI_LARB_OSTDL_PORT(14), 0x4},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x8},
{SMI_LARB_OSTDL_PORT(19), 0x7},
{SMI_LARB_OSTDL_PORT(20), 0x7},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x6},
{SMI_LARB_OSTDL_PORT(23), 0x2},
{SMI_LARB_OSTDL_PORT(24), 0xf},
{SMI_LARB_OSTDL_PORT(25), 0x8},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb10_init_pair[SMI_LARB10_PORT_NUM] = { };
struct mtk_smi_pair smi_larb11_init_pair[SMI_LARB11_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x9},
{SMI_LARB_OSTDL_PORT(1), 0x7},
{SMI_LARB_OSTDL_PORT(2), 0xf},
{SMI_LARB_OSTDL_PORT(3), 0x8},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x8},
{SMI_LARB_OSTDL_PORT(6), 0x9},
{SMI_LARB_OSTDL_PORT(7), 0x3},
{SMI_LARB_OSTDL_PORT(8), 0x3},
{SMI_LARB_OSTDL_PORT(9), 0x6},
{SMI_LARB_OSTDL_PORT(10), 0x7},
{SMI_LARB_OSTDL_PORT(11), 0x4},
{SMI_LARB_OSTDL_PORT(12), 0x9},
{SMI_LARB_OSTDL_PORT(13), 0x3},
{SMI_LARB_OSTDL_PORT(14), 0x4},
{SMI_LARB_OSTDL_PORT(15), 0xe},
{SMI_LARB_OSTDL_PORT(16), 0x1},
{SMI_LARB_OSTDL_PORT(17), 0x7},
{SMI_LARB_OSTDL_PORT(18), 0x1},
{SMI_LARB_OSTDL_PORT(19), 0x1},
{SMI_LARB_OSTDL_PORT(20), 0x1},
{SMI_LARB_OSTDL_PORT(21), 0x1},
{SMI_LARB_OSTDL_PORT(22), 0x1},
{SMI_LARB_OSTDL_PORT(23), 0x1},
{SMI_LARB_OSTDL_PORT(24), 0x1},
{SMI_LARB_OSTDL_PORT(25), 0x1},
{SMI_LARB_OSTDL_PORT(26), 0x1},
{SMI_LARB_OSTDL_PORT(27), 0x1},
{SMI_LARB_OSTDL_PORT(28), 0x1},
};
struct mtk_smi_pair smi_larb12_init_pair[SMI_LARB12_PORT_NUM] = { };
struct mtk_smi_pair smi_larb13_init_pair[SMI_LARB13_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0xc},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0xe},
{SMI_LARB_OSTDL_PORT(4), 0x6},
{SMI_LARB_OSTDL_PORT(5), 0x6},
{SMI_LARB_OSTDL_PORT(6), 0x6},
{SMI_LARB_OSTDL_PORT(7), 0x6},
{SMI_LARB_OSTDL_PORT(8), 0x6},
{SMI_LARB_OSTDL_PORT(9), 0x12},
{SMI_LARB_OSTDL_PORT(10), 0x6},
{SMI_LARB_OSTDL_PORT(11), 0x1},
};
struct mtk_smi_pair smi_larb14_init_pair[SMI_LARB14_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0xc},
{SMI_LARB_OSTDL_PORT(2), 0xc},
{SMI_LARB_OSTDL_PORT(3), 0x28},
{SMI_LARB_OSTDL_PORT(4), 0x12},
{SMI_LARB_OSTDL_PORT(5), 0x6},
};
struct mtk_smi_pair smi_larb15_init_pair[SMI_LARB15_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x1},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0x28},
{SMI_LARB_OSTDL_PORT(4), 0x1},
};
struct mtk_smi_pair smi_larb16_init_pair[SMI_LARB16_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x14},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb17_init_pair[SMI_LARB17_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x14},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb18_init_pair[SMI_LARB18_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x28},
{SMI_LARB_OSTDL_PORT(1), 0x14},
{SMI_LARB_OSTDL_PORT(2), 0x2},
{SMI_LARB_OSTDL_PORT(3), 0xc},
{SMI_LARB_OSTDL_PORT(4), 0x18},
{SMI_LARB_OSTDL_PORT(5), 0x2},
{SMI_LARB_OSTDL_PORT(6), 0x14},
{SMI_LARB_OSTDL_PORT(7), 0x14},
{SMI_LARB_OSTDL_PORT(8), 0x4},
{SMI_LARB_OSTDL_PORT(9), 0x4},
{SMI_LARB_OSTDL_PORT(10), 0x4},
{SMI_LARB_OSTDL_PORT(11), 0x2},
{SMI_LARB_OSTDL_PORT(12), 0x4},
{SMI_LARB_OSTDL_PORT(13), 0x2},
{SMI_LARB_OSTDL_PORT(14), 0x8},
{SMI_LARB_OSTDL_PORT(15), 0x4},
{SMI_LARB_OSTDL_PORT(16), 0x4},
};
struct mtk_smi_pair smi_larb19_init_pair[SMI_LARB19_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x2},
{SMI_LARB_OSTDL_PORT(1), 0x2},
{SMI_LARB_OSTDL_PORT(2), 0x4},
{SMI_LARB_OSTDL_PORT(3), 0x2},
};
struct mtk_smi_pair smi_larb20_init_pair[SMI_LARB20_PORT_NUM] = {
{SMI_LARB_OSTDL_PORT(0), 0x9},
{SMI_LARB_OSTDL_PORT(1), 0x9},
{SMI_LARB_OSTDL_PORT(2), 0x5},
{SMI_LARB_OSTDL_PORT(3), 0x5},
{SMI_LARB_OSTDL_PORT(4), 0x1},
{SMI_LARB_OSTDL_PORT(5), 0x1},
};
/* scen: ALL */
struct mtk_smi_pair *smi_comm_scen_pair[SMI_SCEN_NUM] = {
smi_comm_init_pair,
};
struct mtk_smi_pair *smi_mdp_comm_scen_pair[SMI_SCEN_NUM] = {
smi_mdp_comm_init_pair,
};
struct mtk_smi_pair *smi_sram_comm_scen_pair[SMI_SCEN_NUM] = {
smi_sram_comm_init_pair,
};
struct mtk_smi_pair *smi_sub_comm_scen_pair[SMI_SCEN_NUM] = {
smi_sub_comm_init_pair,
};
struct mtk_smi_pair *smi_larb0_scen_pair[SMI_SCEN_NUM] = {
smi_larb0_init_pair,
};
struct mtk_smi_pair *smi_larb1_scen_pair[SMI_SCEN_NUM] = {
smi_larb1_init_pair,
};
struct mtk_smi_pair *smi_larb2_scen_pair[SMI_SCEN_NUM] = {
smi_larb2_init_pair,
};
struct mtk_smi_pair *smi_larb3_scen_pair[SMI_SCEN_NUM] = {
smi_larb3_init_pair,
};
struct mtk_smi_pair *smi_larb4_scen_pair[SMI_SCEN_NUM] = {
smi_larb4_init_pair,
};
struct mtk_smi_pair *smi_larb5_scen_pair[SMI_SCEN_NUM] = {
smi_larb5_init_pair,
};
struct mtk_smi_pair *smi_larb6_scen_pair[SMI_SCEN_NUM] = {
smi_larb6_init_pair,
};
struct mtk_smi_pair *smi_larb7_scen_pair[SMI_SCEN_NUM] = {
smi_larb7_init_pair,
};
struct mtk_smi_pair *smi_larb8_scen_pair[SMI_SCEN_NUM] = {
smi_larb8_init_pair,
};
struct mtk_smi_pair *smi_larb9_scen_pair[SMI_SCEN_NUM] = {
smi_larb9_init_pair,
};
struct mtk_smi_pair *smi_larb10_scen_pair[SMI_SCEN_NUM] = {
smi_larb10_init_pair,
};
struct mtk_smi_pair *smi_larb11_scen_pair[SMI_SCEN_NUM] = {
smi_larb11_init_pair,
};
struct mtk_smi_pair *smi_larb12_scen_pair[SMI_SCEN_NUM] = {
smi_larb12_init_pair,
};
struct mtk_smi_pair *smi_larb13_scen_pair[SMI_SCEN_NUM] = {
smi_larb13_init_pair,
};
struct mtk_smi_pair *smi_larb14_scen_pair[SMI_SCEN_NUM] = {
smi_larb14_init_pair,
};
struct mtk_smi_pair *smi_larb15_scen_pair[SMI_SCEN_NUM] = {
smi_larb15_init_pair,
};
struct mtk_smi_pair *smi_larb16_scen_pair[SMI_SCEN_NUM] = {
smi_larb16_init_pair,
};
struct mtk_smi_pair *smi_larb17_scen_pair[SMI_SCEN_NUM] = {
smi_larb17_init_pair,
};
struct mtk_smi_pair *smi_larb18_scen_pair[SMI_SCEN_NUM] = {
smi_larb18_init_pair,
};
struct mtk_smi_pair *smi_larb19_scen_pair[SMI_SCEN_NUM] = {
smi_larb19_init_pair,
};
struct mtk_smi_pair *smi_larb20_scen_pair[SMI_SCEN_NUM] = {
smi_larb20_init_pair,
};
u32 smi_scen_pair_num[SMI_DEV_NUM] = {
SMI_LARB0_PORT_NUM, SMI_LARB1_PORT_NUM, SMI_LARB2_PORT_NUM,
SMI_LARB3_PORT_NUM, SMI_LARB4_PORT_NUM, SMI_LARB5_PORT_NUM,
SMI_LARB6_PORT_NUM, SMI_LARB7_PORT_NUM, SMI_LARB8_PORT_NUM,
SMI_LARB9_PORT_NUM,
SMI_LARB10_PORT_NUM, SMI_LARB11_PORT_NUM, SMI_LARB12_PORT_NUM,
SMI_LARB13_PORT_NUM, SMI_LARB14_PORT_NUM, SMI_LARB15_PORT_NUM,
SMI_LARB16_PORT_NUM, SMI_LARB17_PORT_NUM, SMI_LARB18_PORT_NUM,
SMI_LARB19_PORT_NUM, SMI_LARB20_PORT_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
SMI_COMM_MASTER_NUM, SMI_COMM_MASTER_NUM,
};
struct mtk_smi_pair **smi_scen_pair[SMI_DEV_NUM] = {
smi_larb0_scen_pair, smi_larb1_scen_pair, smi_larb2_scen_pair,
smi_larb3_scen_pair, smi_larb4_scen_pair, smi_larb5_scen_pair,
smi_larb6_scen_pair, smi_larb7_scen_pair, smi_larb8_scen_pair,
smi_larb9_scen_pair,
smi_larb10_scen_pair, smi_larb11_scen_pair, smi_larb12_scen_pair,
smi_larb13_scen_pair, smi_larb14_scen_pair, smi_larb15_scen_pair,
smi_larb16_scen_pair, smi_larb17_scen_pair, smi_larb18_scen_pair,
smi_larb19_scen_pair, smi_larb20_scen_pair,
smi_comm_scen_pair, smi_mdp_comm_scen_pair, smi_sram_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
smi_sub_comm_scen_pair, smi_sub_comm_scen_pair,
};
#define SMI_RSI_DEBUG_NUM (29 * 2)
#define SMI_RSI_M0_OFFSET (0x1000)
#define SMI_RSI_M1_OFFSET (0x2000)
u32 smi_rsi_debug_offset[SMI_RSI_DEBUG_NUM] = {
SMI_RSI_M0_OFFSET + RSI_INTLV_CON,
SMI_RSI_M0_OFFSET + RSI_DCM_CON,
SMI_RSI_M0_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M0_OFFSET + RSI_MISC_CON,
SMI_RSI_M0_OFFSET + RSI_STA,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WOSTD_S,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M0_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M0_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_AROSTD_S,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M0_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M0_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M0_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M0_OFFSET + RSI_AXI_DBG_M1,
SMI_RSI_M1_OFFSET + RSI_INTLV_CON,
SMI_RSI_M1_OFFSET + RSI_DCM_CON,
SMI_RSI_M1_OFFSET + RSI_DS_PM_CON,
SMI_RSI_M1_OFFSET + RSI_MISC_CON,
SMI_RSI_M1_OFFSET + RSI_STA,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_S,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AWOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WOSTD_S,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M0,
SMI_RSI_M1_OFFSET + RSI_WOSTD_M1,
SMI_RSI_M1_OFFSET + RSI_WOSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_AROSTD_S,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M0,
SMI_RSI_M1_OFFSET + RSI_AROSTD_M1,
SMI_RSI_M1_OFFSET + RSI_AROSTD_PSEUDO,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WLAST_OWE_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_WDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_S,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M0,
SMI_RSI_M1_OFFSET + RSI_RDAT_CNT_M1,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_S,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M0,
SMI_RSI_M1_OFFSET + RSI_AXI_DBG_M1,
};
#endif
+50
View File
@@ -0,0 +1,50 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_HW_H__
#define __SMI_HW_H__
#include <clk-mt6885-pg.h>
#include <smi_port.h>
static const u32 smi_subsys_to_larbs[NR_SYSS] = {
[SYS_ISP] = (1 << 9),
[SYS_ISP2] = (1 << 11),
[SYS_IPE] = (1 << 19) | (1 << 20) | (1 << 28),
[SYS_VDE] = (1 << 5),
[SYS_VDE2] = (1 << 4),
[SYS_VEN] = (1 << 7),
[SYS_VEN_CORE1] = (1 << 8),
[SYS_MDP] = (1 << 2) | (1 << 3) |
(1 << 22) | (1 << 23) | (1 << 26) | (1 << 27),
[SYS_DIS] = (1 << 0) | (1 << 1) | (1 << 21) | (1 << 24) | (1 << 25),
[SYS_CAM] = (1 << 13) | (1 << 14) | (1 << 15) |
(1 << 29) | (1 << 30) | (1 << 31),
[SYS_CAM_RAWA] = (1 << 16),
[SYS_CAM_RAWB] = (1 << 17),
[SYS_CAM_RAWC] = (1 << 18),
};
#if IS_ENABLED(CONFIG_MMPROFILE)
#include <mmprofile.h>
static const char *smi_mmp_name[NR_SYSS] = {
[SYS_ISP] = "ISP",
[SYS_ISP2] = "ISP2",
[SYS_IPE] = "IPE",
[SYS_VDE] = "VDE",
[SYS_VDE2] = "VDE2",
[SYS_VEN] = "VEN",
[SYS_VEN_CORE1] = "VEN_CORE1",
[SYS_MDP] = "MDP",
[SYS_DIS] = "DIS",
[SYS_CAM] = "CAM",
[SYS_CAM_RAWA] = "CAM_RAWA",
[SYS_CAM_RAWB] = "CAM_RAWB",
[SYS_CAM_RAWC] = "CAM_RAWC",
};
static mmp_event smi_mmp_event[NR_SYSS];
#endif
#endif
@@ -0,0 +1,63 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __SMI_PORT_H__
#define __SMI_PORT_H__
#if IS_ENABLED(CONFIG_MTK_IOMMU_V2)
#include <dt-bindings/memory/mt6885-larb-port.h>
#else
#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port))
#define MTK_IOMMU_TO_LARB(id) (((id) >> 5) & 0x1f)
#define MTK_IOMMU_TO_PORT(id) ((id) & 0x1f)
#endif
#define SMI_OSTD_MAX (0x3f)
#define SMI_COMM_MASTER_NUM (8)
#define SMI_LARB_NUM (21)
#define SMI_LARB0_PORT_NUM (15) /* SYS_DIS */
#define SMI_LARB1_PORT_NUM (15) /* SYS_DIS */
#define SMI_LARB2_PORT_NUM (6) /* SYS_DIS */
#define SMI_LARB3_PORT_NUM (6) /* SYS_DIS */
#define SMI_LARB4_PORT_NUM (11) /* SYS_VDE */
#define SMI_LARB5_PORT_NUM (8) /* SYS_VDE */
#define SMI_LARB6_PORT_NUM (0) /* SYS_VDE */
#define SMI_LARB7_PORT_NUM (27) /* SYS_VEN */
#define SMI_LARB8_PORT_NUM (27) /* SYS_VEN */
#define SMI_LARB9_PORT_NUM (29) /* SYS_IMG1 */
#define SMI_LARB10_PORT_NUM (0) /* SYS_IMG1 */
#define SMI_LARB11_PORT_NUM (29) /* SYS_IMG2 */
#define SMI_LARB12_PORT_NUM (0) /* SYS_IMG2 */
#define SMI_LARB13_PORT_NUM (12) /* SYS_CAM1 */
#define SMI_LARB14_PORT_NUM (6) /* SYS_CAM1 */
#define SMI_LARB15_PORT_NUM (5) /* SYS_CAM1 */
#define SMI_LARB16_PORT_NUM (17) /* SYS_CAM2 */
#define SMI_LARB17_PORT_NUM (17) /* SYS_CAM3 */
#define SMI_LARB18_PORT_NUM (17) /* SYS_CAM4 */
#define SMI_LARB19_PORT_NUM (4) /* SYS_IPE */
#define SMI_LARB20_PORT_NUM (6) /* SYS_IPE */
#define SMI_COMM_NUM (3 + 8)
#define SMI_DEV_NUM ((SMI_LARB_NUM) + (SMI_COMM_NUM))
#define SMI_LARB_CCU0 (13)
#define SMI_LARB_CCU1 (14)
static const bool
SMI_COMM_BUS_SEL[SMI_COMM_MASTER_NUM] = {0, 1, 1, 0, 1, 1, 0, 1,};
static const u32
SMI_LARB_L1ARB[SMI_LARB_NUM] = {
0, 1, 0x10000, 0x10001, 0x10002, 2, SMI_COMM_MASTER_NUM, 3,
0x10003, 0x10004, SMI_COMM_MASTER_NUM, 4,
SMI_COMM_MASTER_NUM, 0x10006, 6, SMI_COMM_MASTER_NUM,
0x10007, 7, 0x10005, 5, 5};
static const u8
SMI_LARB_PORT_NUM[SMI_LARB_NUM] = {15, 15, 6, 6, 11, 8, 0, 27,
27, 29, 0, 29, 0, 12, 6, 5, 17, 17, 17, 4, 6};
#endif
+788
View File
@@ -0,0 +1,788 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2019 MediaTek Inc.
* Author: Ming-Fan Chen <ming-fan.chen@mediatek.com>
*/
#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/limits.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/sched/clock.h>
#include <linux/slab.h>
#include <soc/mediatek/smi.h>
#define DRV_NAME "mtk-smi-dbg"
#define DBG_PRINT_NR (5)
/* LARB */
#define SMI_LARB_STAT (0x0)
#define SMI_LARB_IRQ_EN (0x4)
#define SMI_LARB_IRQ_STATUS (0x8)
#define SMI_LARB_SLP_CON (0xc)
#define SMI_LARB_CON (0x10)
#define SMI_LARB_CON_SET (0x14)
#define SMI_LARB_CON_CLR (0x18)
#define SMI_LARB_CMD_THRT_CON (0x24)
#define SMI_LARB_SW_FLAG (0x40)
#define SMI_LARB_BWL_EN (0x50)
#define SMI_LARB_BWL_CON (0x58)
#define SMI_LARB_OSTDL_EN (0x60)
#define SMI_LARB_ULTRA_DIS (0x70)
#define SMI_LARB_PREULTRA_DIS (0x74)
#define SMI_LARB_FORCE_ULTRA (0x78)
#define SMI_LARB_FORCE_PREULTRA (0x7c)
#define SMI_LARB_SPM_ULTRA_MASK (0x80)
#define SMI_LARB_SPM_STA (0x84)
#define SMI_LARB_EXT_GREQ_VIO (0xa0)
#define SMI_LARB_INT_GREQ_VIO (0xa4)
#define SMI_LARB_OSTD_UDF_VIO (0xa8)
#define SMI_LARB_OSTD_CRS_VIO (0xac)
#define SMI_LARB_FIFO_STAT (0xb0)
#define SMI_LARB_BUS_STAT (0xb4)
#define SMI_LARB_CMD_THRT_STAT (0xb8)
#define SMI_LARB_MON_REQ (0xbc)
#define SMI_LARB_REQ_MASK (0xc0)
#define SMI_LARB_REQ_DET (0xc4)
#define SMI_LARB_EXT_ONGOING (0xc8)
#define SMI_LARB_INT_ONGOING (0xcc)
#define SMI_LARB_WRR_PORT(p) (0x100 + ((p) << 2))
#define SMI_LARB_OSTDL_PORT(p) (0x200 + ((p) << 2))
#define SMI_LARB_OSTD_MON_PORT(p) (0x280 + ((p) << 2))
#define SMI_LARB_NON_SEC_CON(p) (0x380 + ((p) << 2))
#define SMI_LARB_MON_EN (0x400)
#define SMI_LARB_MON_CLR (0x404)
#define SMI_LARB_MON_PORT (0x408)
#define SMI_LARB_MON_CON (0x40c)
#define SMI_LARB_MON_ACT_CNT (0x410)
#define SMI_LARB_MON_REQ_CNT (0x414)
#define SMI_LARB_MON_BEAT_CNT (0x418)
#define SMI_LARB_MON_BYTE_CNT (0x41c)
#define SMI_LARB_MON_CP_CNT (0x420)
#define SMI_LARB_MON_DP_CNT (0x424)
#define SMI_LARB_MON_OSTD_CNT (0x428)
#define SMI_LARB_MON_CP_MAX (0x430)
#define SMI_LARB_MON_COS_MAX (0x434)
#define SMI_LARB_REGS_NR (126)
static u32 smi_larb_regs[SMI_LARB_REGS_NR] = {
SMI_LARB_STAT, SMI_LARB_IRQ_EN, SMI_LARB_IRQ_STATUS, SMI_LARB_SLP_CON,
SMI_LARB_CON, SMI_LARB_CON_SET, SMI_LARB_CON_CLR, SMI_LARB_CMD_THRT_CON,
SMI_LARB_SW_FLAG, SMI_LARB_BWL_EN, SMI_LARB_BWL_CON, SMI_LARB_OSTDL_EN,
SMI_LARB_ULTRA_DIS, SMI_LARB_PREULTRA_DIS,
SMI_LARB_FORCE_ULTRA, SMI_LARB_FORCE_PREULTRA,
SMI_LARB_SPM_ULTRA_MASK, SMI_LARB_SPM_STA,
SMI_LARB_EXT_GREQ_VIO, SMI_LARB_INT_GREQ_VIO,
SMI_LARB_OSTD_UDF_VIO, SMI_LARB_OSTD_CRS_VIO,
SMI_LARB_FIFO_STAT, SMI_LARB_BUS_STAT, SMI_LARB_CMD_THRT_STAT,
SMI_LARB_MON_REQ, SMI_LARB_REQ_MASK, SMI_LARB_REQ_DET,
SMI_LARB_EXT_ONGOING, SMI_LARB_INT_ONGOING,
SMI_LARB_WRR_PORT(0), SMI_LARB_WRR_PORT(1), SMI_LARB_WRR_PORT(2),
SMI_LARB_WRR_PORT(3), SMI_LARB_WRR_PORT(4), SMI_LARB_WRR_PORT(5),
SMI_LARB_WRR_PORT(6), SMI_LARB_WRR_PORT(7), SMI_LARB_WRR_PORT(8),
SMI_LARB_WRR_PORT(9), SMI_LARB_WRR_PORT(10), SMI_LARB_WRR_PORT(11),
SMI_LARB_WRR_PORT(12), SMI_LARB_WRR_PORT(13), SMI_LARB_WRR_PORT(14),
SMI_LARB_WRR_PORT(15), SMI_LARB_WRR_PORT(16), SMI_LARB_WRR_PORT(17),
SMI_LARB_WRR_PORT(18), SMI_LARB_WRR_PORT(19), SMI_LARB_WRR_PORT(20),
SMI_LARB_WRR_PORT(21), SMI_LARB_WRR_PORT(22), SMI_LARB_WRR_PORT(23),
SMI_LARB_WRR_PORT(24), SMI_LARB_WRR_PORT(25), SMI_LARB_WRR_PORT(26),
SMI_LARB_WRR_PORT(27), SMI_LARB_WRR_PORT(28), SMI_LARB_WRR_PORT(29),
SMI_LARB_WRR_PORT(30), SMI_LARB_WRR_PORT(31),
SMI_LARB_OSTDL_PORT(0), SMI_LARB_OSTDL_PORT(1),
SMI_LARB_OSTDL_PORT(2), SMI_LARB_OSTDL_PORT(3),
SMI_LARB_OSTDL_PORT(4), SMI_LARB_OSTDL_PORT(5),
SMI_LARB_OSTDL_PORT(6), SMI_LARB_OSTDL_PORT(7),
SMI_LARB_OSTDL_PORT(8), SMI_LARB_OSTDL_PORT(9),
SMI_LARB_OSTDL_PORT(10), SMI_LARB_OSTDL_PORT(11),
SMI_LARB_OSTDL_PORT(12), SMI_LARB_OSTDL_PORT(13),
SMI_LARB_OSTDL_PORT(14), SMI_LARB_OSTDL_PORT(15),
SMI_LARB_OSTDL_PORT(16), SMI_LARB_OSTDL_PORT(17),
SMI_LARB_OSTDL_PORT(18), SMI_LARB_OSTDL_PORT(19),
SMI_LARB_OSTDL_PORT(20), SMI_LARB_OSTDL_PORT(21),
SMI_LARB_OSTDL_PORT(22), SMI_LARB_OSTDL_PORT(23),
SMI_LARB_OSTDL_PORT(24), SMI_LARB_OSTDL_PORT(25),
SMI_LARB_OSTDL_PORT(26), SMI_LARB_OSTDL_PORT(27),
SMI_LARB_OSTDL_PORT(28), SMI_LARB_OSTDL_PORT(29),
SMI_LARB_OSTDL_PORT(30), SMI_LARB_OSTDL_PORT(31),
SMI_LARB_OSTD_MON_PORT(0), SMI_LARB_OSTD_MON_PORT(1),
SMI_LARB_OSTD_MON_PORT(2), SMI_LARB_OSTD_MON_PORT(3),
SMI_LARB_OSTD_MON_PORT(4), SMI_LARB_OSTD_MON_PORT(5),
SMI_LARB_OSTD_MON_PORT(6), SMI_LARB_OSTD_MON_PORT(7),
SMI_LARB_OSTD_MON_PORT(8), SMI_LARB_OSTD_MON_PORT(9),
SMI_LARB_OSTD_MON_PORT(10), SMI_LARB_OSTD_MON_PORT(11),
SMI_LARB_OSTD_MON_PORT(12), SMI_LARB_OSTD_MON_PORT(13),
SMI_LARB_OSTD_MON_PORT(14), SMI_LARB_OSTD_MON_PORT(15),
SMI_LARB_OSTD_MON_PORT(16), SMI_LARB_OSTD_MON_PORT(17),
SMI_LARB_OSTD_MON_PORT(18), SMI_LARB_OSTD_MON_PORT(19),
SMI_LARB_OSTD_MON_PORT(20), SMI_LARB_OSTD_MON_PORT(21),
SMI_LARB_OSTD_MON_PORT(22), SMI_LARB_OSTD_MON_PORT(23),
SMI_LARB_OSTD_MON_PORT(24), SMI_LARB_OSTD_MON_PORT(25),
SMI_LARB_OSTD_MON_PORT(26), SMI_LARB_OSTD_MON_PORT(27),
SMI_LARB_OSTD_MON_PORT(28), SMI_LARB_OSTD_MON_PORT(29),
SMI_LARB_OSTD_MON_PORT(30), SMI_LARB_OSTD_MON_PORT(31),
};
/* COMM */
#define SMI_L1LEN (0x100)
#define SMI_L1ARB(m) (0x104 + ((m) << 2))
#define SMI_BUS_SEL (0x220)
#define SMI_WRR_REG0 (0x228)
#define SMI_WRR_REG1 (0x22c)
#define SMI_READ_FIFO_TH (0x230)
#define SMI_M4U_TH (0x234)
#define SMI_FIFO_TH1 (0x238)
#define SMI_FIFO_TH2 (0x23c)
#define SMI_DCM (0x300)
#define SMI_ELA (0x304)
#define SMI_M1_RULTRA_WRR0 (0x308)
#define SMI_M1_RULTRA_WRR1 (0x30c)
#define SMI_M1_WULTRA_WRR0 (0x310)
#define SMI_M1_WULTRA_WRR1 (0x314)
#define SMI_M2_RULTRA_WRR0 (0x318)
#define SMI_M2_RULTRA_WRR1 (0x31c)
#define SMI_M2_WULTRA_WRR0 (0x320)
#define SMI_M2_WULTRA_WRR1 (0x324)
#define SMI_COMMON_CLAMP_EN (0x3c0)
#define SMI_COMMON_CLAMP_EN_SET (0x3c4)
#define SMI_COMMON_CLAMP_EN_CLR (0x3c8)
#define SMI_DEBUG_S(s) (0x400 + ((s) << 2))
#define SMI_DEBUG_M0 (0x430)
#define SMI_DEBUG_M1 (0x434)
#define SMI_DEBUG_MISC (0x440)
#define SMI_DUMMY (0x444)
#define SMI_MON_ENA(m) ((m) ? (0x600 + (((m) - 1) * 0x50)) : 0x1a0)
#define SMI_MON_CLR(m) (SMI_MON_ENA(m) + 0x4)
#define SMI_MON_TYPE(m) (SMI_MON_ENA(m) + 0xc)
#define SMI_MON_CON(m) (SMI_MON_ENA(m) + 0x10)
#define SMI_MON_ACT_CNT(m) (SMI_MON_ENA(m) + 0x20)
#define SMI_MON_REQ_CNT(m) (SMI_MON_ENA(m) + 0x24)
#define SMI_MON_OSTD_CNT(m) (SMI_MON_ENA(m) + 0x28)
#define SMI_MON_BEA_CNT(m) (SMI_MON_ENA(m) + 0x2c)
#define SMI_MON_BYT_CNT(m) (SMI_MON_ENA(m) + 0x30)
#define SMI_MON_CP_CNT(m) (SMI_MON_ENA(m) + 0x34)
#define SMI_MON_DP_CNT(m) (SMI_MON_ENA(m) + 0x38)
#define SMI_MON_CP_MAX(m) (SMI_MON_ENA(m) + 0x3c)
#define SMI_MON_COS_MAX(m) (SMI_MON_ENA(m) + 0x40)
#define SMI_COMM_REGS_NR (41)
static u32 smi_comm_regs[SMI_COMM_REGS_NR] = {
SMI_L1LEN,
SMI_L1ARB(0), SMI_L1ARB(1), SMI_L1ARB(2), SMI_L1ARB(3),
SMI_L1ARB(4), SMI_L1ARB(5), SMI_L1ARB(6), SMI_L1ARB(7),
SMI_BUS_SEL, SMI_WRR_REG0, SMI_WRR_REG1,
SMI_READ_FIFO_TH, SMI_M4U_TH, SMI_FIFO_TH1, SMI_FIFO_TH2,
SMI_DCM, SMI_ELA,
SMI_M1_RULTRA_WRR0, SMI_M1_RULTRA_WRR1, SMI_M1_WULTRA_WRR0,
SMI_M1_WULTRA_WRR1, SMI_M2_RULTRA_WRR0, SMI_M2_RULTRA_WRR1,
SMI_M2_WULTRA_WRR0, SMI_M2_WULTRA_WRR1,
SMI_COMMON_CLAMP_EN, SMI_COMMON_CLAMP_EN_SET, SMI_COMMON_CLAMP_EN_CLR,
SMI_DEBUG_S(0), SMI_DEBUG_S(1), SMI_DEBUG_S(2), SMI_DEBUG_S(3),
SMI_DEBUG_S(4), SMI_DEBUG_S(5), SMI_DEBUG_S(6), SMI_DEBUG_S(7),
SMI_DEBUG_M0, SMI_DEBUG_M1, SMI_DEBUG_MISC, SMI_DUMMY,
};
/* MMSYS */
#define MMSYS_CG_CON0 (0x100)
#define MMSYS_CG_CON1 (0x110)
#define MMSYS_HW_DCM_1ST_DIS0 (0x120)
#define MMSYS_HW_DCM_1ST_DIS_SET0 (0x124)
#define MMSYS_HW_DCM_2ND_DIS0 (0x130)
#define MMSYS_SW0_RST_B (0x140)
#define DISP_GALS_DBG(x) (0x520 + ((x) << 2))
#define MMSYS_GALS_DBG(x) (0x914 + ((x) << 2))
#define SMI_MMSYS_REGS_NR (30)
static u32 smi_mmsys_regs[SMI_MMSYS_REGS_NR] = {
MMSYS_CG_CON0, MMSYS_CG_CON1,
MMSYS_HW_DCM_1ST_DIS0, MMSYS_HW_DCM_1ST_DIS_SET0,
MMSYS_HW_DCM_2ND_DIS0, MMSYS_SW0_RST_B,
DISP_GALS_DBG(0), DISP_GALS_DBG(1), DISP_GALS_DBG(2), DISP_GALS_DBG(3),
DISP_GALS_DBG(4), DISP_GALS_DBG(5), DISP_GALS_DBG(6), DISP_GALS_DBG(7),
DISP_GALS_DBG(8), DISP_GALS_DBG(9), DISP_GALS_DBG(10),
DISP_GALS_DBG(11), DISP_GALS_DBG(12), DISP_GALS_DBG(13),
DISP_GALS_DBG(14), DISP_GALS_DBG(15),
MMSYS_GALS_DBG(0), MMSYS_GALS_DBG(1), MMSYS_GALS_DBG(2),
MMSYS_GALS_DBG(3), MMSYS_GALS_DBG(4), MMSYS_GALS_DBG(5),
MMSYS_GALS_DBG(6), MMSYS_GALS_DBG(7),
};
enum {TYPE_LARB, TYPE_COMM, TYPE_MMSYS, TYPE_NR};
#define SMI_MON_BUS_NR (4)
#define SMI_MON_CNT_NR (9)
#define SMI_MON_DEC(val, bit) (((val) >> mon_bit[bit]) & \
((1 << (mon_bit[(bit) + 1] - mon_bit[bit])) - 1))
#define SMI_MON_SET(base, val, mask, bit) \
(((base) & ~((mask) << (bit))) | (((val) & (mask)) << (bit)))
enum { SET_OPS_DUMP, SET_OPS_MON_RUN, SET_OPS_MON_SET, SET_OPS_MON_FRAME, };
enum {
MON_BIT_OPTN, MON_BIT_PORT, MON_BIT_RDWR, MON_BIT_MSTR,
MON_BIT_RQST, MON_BIT_DSTN, MON_BIT_PRLL, MON_BIT_LARB, MON_BIT_NR,
};
/*
* | LARB | PARALLEL |28
* | DESTINATION | REQUEST |24
* | |20
* | MASTER |16
* | RW | |12
* | PORT | 8
*/
static const u32 mon_bit[MON_BIT_NR + 1] = {0, 8, 14, 16, 24, 26, 28, 30, 32};
struct mtk_smi_dbg_node {
struct device *dev;
void __iomem *va;
phys_addr_t pa;
u32 nr_clks;
struct clk **clks;
u32 nr_regs;
u32 *regs;
u32 mon[SMI_MON_BUS_NR];
u8 busy;
struct mtk_smi_dbg_node *next;
};
struct mtk_smi_dbg {
struct dentry *fs;
struct mtk_smi_dbg_node larb[MTK_LARB_NR_MAX];
struct mtk_smi_dbg_node comm[MTK_LARB_NR_MAX];
struct mtk_smi_dbg_node mmsys;
u64 exec;
u8 frame;
};
static struct mtk_smi_dbg *gsmi;
static void mtk_smi_dbg_print(struct mtk_smi_dbg_node *node, const u8 type)
{
char buf[LINK_MAX + 1] = {0};
u32 val[DBG_PRINT_NR];
u32 reg = type ? SMI_DEBUG_MISC : SMI_LARB_STAT;
s32 diff, i, j, len, ret, rpm;
if (!node->dev || !node->va)
return;
/* TODO */
pm_runtime_get_sync(node->dev);
rpm = pm_runtime_get_if_in_use(node->dev);
if (rpm <= 0)
return;
node->busy = 0;
for (i = 0, len = 0; i < node->nr_regs; i++) {
memset(val, 0, sizeof(val));
for (j = 0, diff = 0; j < DBG_PRINT_NR; j++) {
val[j] = readl_relaxed(node->va + node->regs[i]);
if (j && val[j] != val[j - 1])
diff += 1;
if (node->regs[i] == reg)
node->busy += (type ^ val[j]);
}
if (!diff && !val[0])
continue;
if (diff)
ret = snprintf(buf + len, LINK_MAX - len,
" %#x=%#x %#x %#x %#x %#x,", node->regs[i],
val[0], val[1], val[2], val[3], val[4]);
else
ret = snprintf(buf + len, LINK_MAX - len,
" %#x=%#x,", node->regs[i], val[0]);
if (ret < 0 || ret >= LINK_MAX - len) {
snprintf(buf + len, LINK_MAX - len, "%c", '\0');
dev_info(node->dev, "%s\n", buf);
memset(buf, '\0', sizeof(buf));
len = 0;
i -= 1;
} else
len += ret;
}
dev_info(node->dev, "========== rpm:%d busy:%d/%d ==========\n",
rpm, node->busy, DBG_PRINT_NR);
pm_runtime_put_sync(node->dev);
}
static void mtk_smi_dbg_hang_detect_single(
struct mtk_smi_dbg *smi, const bool larb, const u32 id)
{
struct mtk_smi_dbg_node *node = larb ? &smi->larb[id] : &smi->comm[id];
dev_info(node->dev, "%s: larb:%d id:%u\n", __func__, larb, id);
mtk_smi_dbg_print(node, larb ? TYPE_LARB : TYPE_COMM);
mtk_smi_dbg_print(node->next, larb ? TYPE_COMM : TYPE_MMSYS);
}
static void mtk_smi_dbg_conf_set_run(
struct mtk_smi_dbg *smi, const bool larb, const u32 id)
{
struct mtk_smi_dbg_node node = larb ? smi->larb[id] : smi->comm[id];
const char *name = larb ? "larb" : "common";
u32 prll, dstn, rqst, rdwr[SMI_MON_BUS_NR], port[SMI_MON_BUS_NR];
u32 i, *mon = larb ? smi->larb[id].mon : smi->comm[id].mon;
u32 mon_port, val_port, mon_con, val_con, mon_ena, val_ena;
if (!node.dev || !node.va || !mon[0] || mon[0] == ~0)
return;
prll = SMI_MON_DEC(mon[0], MON_BIT_PRLL);
dstn = SMI_MON_DEC(mon[0], MON_BIT_DSTN);
rqst = SMI_MON_DEC(mon[0], MON_BIT_RQST);
for (i = 0; i < SMI_MON_BUS_NR; i++) {
rdwr[i] = SMI_MON_DEC(mon[i], MON_BIT_RDWR);
port[i] = SMI_MON_DEC(mon[i], MON_BIT_PORT);
}
dev_info(node.dev,
"%pa.%s:%u prll:%u dstn:%u rqst:%u port:rdwr %u:%u %u:%u %u:%u %u:%u\n",
&node.pa, name, id, prll, dstn, rqst, port[0], rdwr[0],
port[1], rdwr[1], port[2], rdwr[2], port[3], rdwr[3]);
mon_port = larb ? SMI_LARB_MON_PORT : SMI_MON_TYPE(0);
val_port = readl_relaxed(node.va + mon_port);
if (!larb)
val_port = SMI_MON_SET(val_port, rqst, 0x3, 4);
for (i = 0; i < SMI_MON_BUS_NR; i++)
val_port = larb ?
SMI_MON_SET(val_port, port[i], 0x3f, (i << 3)) :
SMI_MON_SET(val_port, rdwr[i], 0x1, i);
writel_relaxed(val_port, node.va + mon_port);
mon_con = larb ? SMI_LARB_MON_CON : SMI_MON_CON(0);
val_con = readl_relaxed(node.va + mon_con);
if (larb) {
val_con = SMI_MON_SET(val_con, prll, 0x1, 10);
val_con = SMI_MON_SET(val_con, rqst, 0x3, 4);
val_con = SMI_MON_SET(val_con, rdwr[0], 0x3, 2);
} else
for (i = 0; i < SMI_MON_BUS_NR; i++)
val_con = SMI_MON_SET(
val_con, port[i], 0xf, (i + 1) << 2);
writel_relaxed(val_con, node.va + mon_con);
mon_ena = larb ? SMI_LARB_MON_EN : SMI_MON_ENA(0);
val_ena = (larb ? readl_relaxed(node.va + mon_ena) : SMI_MON_SET(
readl_relaxed(node.va + mon_ena), prll, 0x1, 1)) | 0x1;
dev_info(node.dev,
"%pa.%s:%u MON_PORT:%#x=%#x MON_CON:%#x=%#x MON_ENA:%#x=%#x\n",
&node.pa, name, id,
mon_port, val_port, mon_con, val_con, mon_ena, val_ena);
smi->exec = sched_clock();
writel_relaxed(val_ena, node.va + mon_ena);
}
static void mtk_smi_dbg_conf_stop_clr(
struct mtk_smi_dbg *smi, const bool larb, const u32 id)
{
struct mtk_smi_dbg_node node = larb ? smi->larb[id] : smi->comm[id];
void __iomem *va = node.va;
u32 mon = larb ? smi->larb[id].mon[0] : smi->comm[id].mon[0];
u32 reg, val[SMI_MON_CNT_NR];
if (!node.dev || !va || mon == ~0)
return;
reg = larb ? SMI_LARB_MON_EN : SMI_MON_ENA(0);
writel_relaxed(readl_relaxed(node.va + reg) & ~1, node.va + reg);
smi->exec = sched_clock() - smi->exec;
/* ACT, REQ, BEA, BYT, CP, DP, OSTD, CP_MAX, COS_MAX */
val[0] = readl_relaxed(
va + (larb ? SMI_LARB_MON_ACT_CNT : SMI_MON_ACT_CNT(0)));
val[1] = readl_relaxed(
va + (larb ? SMI_LARB_MON_REQ_CNT : SMI_MON_REQ_CNT(0)));
val[2] = readl_relaxed(
va + (larb ? SMI_LARB_MON_BEAT_CNT : SMI_MON_BEA_CNT(0)));
val[3] = readl_relaxed(
va + (larb ? SMI_LARB_MON_BYTE_CNT : SMI_MON_BYT_CNT(0)));
val[4] = readl_relaxed(
va + (larb ? SMI_LARB_MON_CP_CNT : SMI_MON_CP_CNT(0)));
val[5] = readl_relaxed(
va + (larb ? SMI_LARB_MON_DP_CNT : SMI_MON_DP_CNT(0)));
val[6] = readl_relaxed(
va + (larb ? SMI_LARB_MON_OSTD_CNT : SMI_MON_OSTD_CNT(0)));
val[7] = readl_relaxed(
va + (larb ? SMI_LARB_MON_CP_MAX : SMI_MON_CP_MAX(0)));
val[8] = readl_relaxed(
va + (larb ? SMI_LARB_MON_COS_MAX : SMI_MON_COS_MAX(0)));
dev_info(node.dev,
"%pa.%s:%u exec:%llu prll:%u ACT:%u REQ:%u BEA:%u BYT:%u CP:%u DP:%u OSTD:%u CP_MAX:%u COS_MAX:%u\n",
&node.pa, larb ? "larb" : "common", id, smi->exec,
SMI_MON_DEC(mon, MON_BIT_PRLL), val[0], val[1], val[2], val[3],
val[4], val[5], val[6], val[7], val[8]);
reg = larb ? SMI_LARB_MON_CLR : SMI_MON_CLR(0);
writel_relaxed(readl_relaxed(va + reg) | 1, node.va + reg);
writel_relaxed(readl_relaxed(va + reg) & ~1, node.va + reg);
}
static void mtk_smi_dbg_monitor_run(struct mtk_smi_dbg *smi)
{
s32 i, larb_on[MTK_LARB_NR_MAX], comm_on[MTK_LARB_NR_MAX];
smi->exec = sched_clock();
smi->frame = smi->frame ? smi->frame : 10;
pr_info("%s: exec:%llu frame:%u\n", __func__, smi->exec, smi->frame);
for (i = 0; i < ARRAY_SIZE(smi->larb); i++) {
if (!smi->larb[i].dev)
continue;
larb_on[i] = pm_runtime_get_sync(smi->larb[i].dev);
if (larb_on[i] > 0)
mtk_smi_dbg_conf_set_run(smi, true, i);
}
for (i = 0; i < ARRAY_SIZE(smi->comm); i++) {
if (!smi->comm[i].dev)
continue;
comm_on[i] = pm_runtime_get_sync(smi->comm[i].dev);
if (comm_on[i] > 0)
mtk_smi_dbg_conf_set_run(smi, false, i);
}
while (sched_clock() - smi->exec < 16700000ULL * smi->frame) // 16.7 ms
usleep_range(1000, 3000);
for (i = 0; i < ARRAY_SIZE(smi->larb); i++) {
if (larb_on[i] > 0 && smi->larb[i].dev) {
mtk_smi_dbg_conf_stop_clr(smi, true, i);
pm_runtime_put_sync(smi->larb[i].dev);
}
memset(smi->larb[i].mon, ~0, sizeof(u32) * SMI_MON_BUS_NR);
}
for (i = 0; i < ARRAY_SIZE(smi->comm); i++) {
if (comm_on[i] > 0 && smi->comm[i].dev) {
mtk_smi_dbg_conf_stop_clr(smi, false, i);
pm_runtime_put_sync(smi->comm[i].dev);
}
memset(smi->comm[i].mon, ~0, sizeof(u32) * SMI_MON_BUS_NR);
}
}
static void mtk_smi_dbg_monitor_set(struct mtk_smi_dbg *smi, const u64 val)
{
struct mtk_smi_dbg_node *nodes =
SMI_MON_DEC(val, MON_BIT_LARB) ? smi->larb : smi->comm;
const char *name =
SMI_MON_DEC(val, MON_BIT_LARB) ? "larb" : "common";
u32 i, *mon, mstr = SMI_MON_DEC(val, MON_BIT_MSTR);
if (mstr >= MTK_LARB_NR_MAX || !nodes[mstr].dev || !nodes[mstr].va) {
pr_info("%s: invalid %s:%d\n", __func__, name, mstr);
return;
}
mon = nodes[mstr].mon;
for (i = 0; i < SMI_MON_BUS_NR; i++)
if (mon[i] == ~0) {
mon[i] = val;
break;
}
if (i == SMI_MON_BUS_NR)
pr_info("%s: over monitor: %pa.%s:%u mon:%#x %#x %#x %#x\n",
__func__, &nodes[mstr].pa, name, mstr,
mon[0], mon[1], mon[2], mon[3]);
else
pr_info("%s: %pa.%s:%u mon:%#x %#x %#x %#x\n",
__func__, &nodes[mstr].pa, name, mstr,
mon[0], mon[1], mon[2], mon[3]);
}
static int mtk_smi_dbg_get(void *data, u64 *val)
{
pr_info("%s: val:%llu\n", __func__, *val);
return 0;
}
static int mtk_smi_dbg_set(void *data, u64 val)
{
struct mtk_smi_dbg *smi = (struct mtk_smi_dbg *)data;
u64 exval;
if (!smi) {
pr_info("%s: not init yet\n", __func__);
return -EFAULT;
}
pr_info("%s: val:%#llx\n", __func__, val);
switch (val & 0x7) {
case SET_OPS_DUMP:
mtk_smi_dbg_hang_detect_single(smi,
SMI_MON_DEC(val, MON_BIT_LARB) ? true : false,
SMI_MON_DEC(val, MON_BIT_MSTR));
break;
case SET_OPS_MON_RUN:
mtk_smi_dbg_monitor_run(smi);
break;
case SET_OPS_MON_SET:
mtk_smi_dbg_monitor_set(smi, val);
break;
case SET_OPS_MON_FRAME:
smi->frame = (u8)SMI_MON_DEC(val, MON_BIT_PORT);
break;
default:
/* example : monitor for 5 frames */
mtk_smi_dbg_set(data,
(5 << mon_bit[MON_BIT_PORT]) | SET_OPS_MON_FRAME);
/* comm0 : 0:rd */
exval = (0 << mon_bit[MON_BIT_MSTR]) |
(0 << mon_bit[MON_BIT_RDWR]) |
(0 << mon_bit[MON_BIT_PORT]) | SET_OPS_MON_SET;
mtk_smi_dbg_set(data, exval);
/* larb1 : 2:wr 3:all */
exval = (1 << mon_bit[MON_BIT_LARB]) |
(1 << mon_bit[MON_BIT_PRLL]) |
(1 << mon_bit[MON_BIT_MSTR]) |
(2 << mon_bit[MON_BIT_RDWR]) |
(2 << mon_bit[MON_BIT_PORT]) | SET_OPS_MON_SET;
mtk_smi_dbg_set(data, exval);
exval = (1 << mon_bit[MON_BIT_LARB]) |
(1 << mon_bit[MON_BIT_PRLL]) |
(1 << mon_bit[MON_BIT_MSTR]) |
(0 << mon_bit[MON_BIT_RDWR]) |
(3 << mon_bit[MON_BIT_PORT]) | SET_OPS_MON_SET;
mtk_smi_dbg_set(data, exval);
mtk_smi_dbg_set(data, SET_OPS_MON_RUN);
break;
}
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(
mtk_smi_dbg_fops, mtk_smi_dbg_get, mtk_smi_dbg_set, "%llu");
static s32
mtk_smi_dbg_node_enable(struct mtk_smi_dbg_node *node, const bool enable)
{
s32 i, j, ret = 0;
if (enable)
for (i = 0; i < node->nr_clks; i++) {
ret = clk_prepare_enable(node->clks[i]);
if (ret) {
for (j = i - 1; j >= 0; j--)
clk_disable_unprepare(node->clks[j]);
break;
}
}
else
for (i = node->nr_clks - 1; i >= 0; i--)
clk_disable_unprepare(node->clks[i]);
return ret;
}
s32 mtk_smi_dbg_larb_prepare_enable(const u32 id, const char *user)
{
struct mtk_smi_dbg *smi = gsmi;
s32 ret;
if (!smi) {
pr_info("%s: not init yet\n", __func__);
return -EFAULT;
}
if (id >= MTK_LARB_NR_MAX || !smi->larb[id].dev) {
pr_info("%s: invalid larb-id:%u from user:%s\n", id, user);
return -EINVAL;
}
if (smi->larb[id].next && smi->larb[id].next->clks) {
ret = mtk_smi_dbg_node_enable(smi->larb[id].next, true);
if (ret)
return ret;
}
ret = mtk_smi_dbg_node_enable(&smi->larb[id], true);
return ret;
}
EXPORT_SYMBOL_GPL(mtk_smi_dbg_larb_prepare_enable);
void mtk_smi_dbg_larb_disable_unprepare(const u32 id, const char *user)
{
struct mtk_smi_dbg *smi = gsmi;
if (!smi) {
pr_info("%s: not init yet\n", __func__);
return;
}
if (id >= MTK_LARB_NR_MAX || !smi->larb[id].dev) {
pr_info("%s: invalid larb-id:%u from user:%s\n", id, user);
return;
}
mtk_smi_dbg_node_enable(&smi->larb[id], false);
if (smi->larb[id].next && smi->larb[id].next->clks)
mtk_smi_dbg_node_enable(smi->larb[id].next, false);
}
EXPORT_SYMBOL_GPL(mtk_smi_dbg_larb_disable_unprepare);
s32 mtk_smi_dbg_hang_detect(const char *user)
{
struct mtk_smi_dbg *smi = gsmi;
s32 i;
if (!smi) {
pr_info("%s: not init yet\n", __func__);
return -EFAULT;
}
pr_info("%s: caller:%s\n", __func__, user);
for (i = 0; i < ARRAY_SIZE(smi->larb); i++)
mtk_smi_dbg_print(&smi->larb[i], TYPE_LARB);
for (i = 0; i < ARRAY_SIZE(smi->comm); i++)
mtk_smi_dbg_print(&smi->comm[i], TYPE_COMM);
mtk_smi_dbg_print(&smi->mmsys, TYPE_MMSYS);
/* TODO */
return 0;
}
EXPORT_SYMBOL_GPL(mtk_smi_dbg_hang_detect);
static s32 mtk_smi_dbg_parse(
struct mtk_smi_dbg_node *node, struct platform_device *pdev, const u8 type)
{
struct resource *res;
struct property *prop;
const char *name;
s32 i = 0, ret;
node->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -EINVAL;
node->pa = res->start;
node->va = devm_ioremap(node->dev, res->start, 0x1000);
if (IS_ERR(node->va))
return PTR_ERR(node->va);
node->nr_regs = type ? (type == TYPE_MMSYS ?
SMI_MMSYS_REGS_NR : SMI_COMM_REGS_NR) : SMI_LARB_REGS_NR;
node->regs = type ? (type == TYPE_MMSYS ?
smi_mmsys_regs : smi_comm_regs) : smi_larb_regs;
memset(node->mon, ~0, sizeof(node->mon));
dev_info(node->dev, "pa:%pa va:%#x regs:%u\n",
&node->pa, node->va, node->nr_regs);
ret = of_property_count_strings(node->dev->of_node, "clock-names");
if (ret < 0)
return ret;
node->nr_clks = (u32)ret;
node->clks = devm_kcalloc(
node->dev, node->nr_clks, sizeof(*node->clks), GFP_KERNEL);
if (!node->clks)
return -ENOMEM;
of_property_for_each_string(
node->dev->of_node, "clock-names", prop, name) {
node->clks[i] = devm_clk_get(node->dev, name);
if (IS_ERR(node->clks[i])) {
dev_info(node->dev, "%d:%s clk_get failed\n", i, name);
break;
}
dev_dbg(node->dev, "clks[%d]:%s\n", i, name);
i += 1;
}
return 0;
}
static char *mtk_smi_dbg_comp[] = {
"mediatek,mt6761-smi-larb", "mediatek,mt6779-smi-larb", ""
};
static s32 mtk_smi_dbg_probe(struct mtk_smi_dbg *smi)
{
struct device_node *node, *next;
struct platform_device *pdev;
u32 nr_larbs = 0, nr_comms = 0;
s32 id, i = 0, j, ret;
while (strncmp(mtk_smi_dbg_comp[i], "", 1)) {
pr_debug("%s: comp[%d]:%s\n", __func__, i, mtk_smi_dbg_comp[i]);
for_each_compatible_node(node, NULL, mtk_smi_dbg_comp[i]) {
if (!node)
break;
if (of_property_read_u32(node, "mediatek,larb-id", &id))
id = nr_larbs;
pdev = of_find_device_by_node(node);
of_node_put(node);
if (!pdev)
return -EINVAL;
dev_info(&pdev->dev, "larb-id:%u\n", id);
ret = mtk_smi_dbg_parse(
&smi->larb[id], pdev, TYPE_LARB);
if (ret)
return ret;
nr_larbs += 1;
next = of_parse_phandle(node, "mediatek,smi", 0);
if (!next)
return -EINVAL;
pdev = of_find_device_by_node(next);
of_node_put(next);
if (!pdev)
return -EINVAL;
for (j = 0; j < nr_comms; j++)
if (&pdev->dev == smi->comm[j].dev)
break;
smi->larb[id].next = &smi->comm[j];
if (j < nr_comms)
continue;
dev_info(&pdev->dev, "comm-id:%u\n", j);
ret = mtk_smi_dbg_parse(&smi->comm[j], pdev, TYPE_COMM);
if (ret)
return ret;
nr_comms += 1;
smi->comm[j].next = &smi->mmsys;
if (smi->mmsys.dev)
continue;
next = of_parse_phandle(next, "subsys", 0);
if (!next)
continue;
pdev = of_find_device_by_node(next);
of_node_put(next);
if (!pdev)
continue;
dev_info(&pdev->dev, "smi-subsys\n");
mtk_smi_dbg_parse(&smi->mmsys, pdev, TYPE_MMSYS);
}
i += 1;
}
return 0;
}
static int __init mtk_smi_dbg_init(void)
{
struct mtk_smi_dbg *smi;
smi = kzalloc(sizeof(*smi), GFP_KERNEL);
if (!smi)
return -ENOMEM;
gsmi = smi;
smi->fs = debugfs_create_file(
DRV_NAME, 0444, NULL, smi, &mtk_smi_dbg_fops);
if (IS_ERR(smi->fs))
return PTR_ERR(smi->fs);
mtk_smi_dbg_probe(smi);
mtk_smi_dbg_hang_detect(DRV_NAME);
return 0;
}
late_initcall(mtk_smi_dbg_init);
MODULE_LICENSE("GPL v2");
+124
View File
@@ -0,0 +1,124 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_CONF_DBG_H__
#define __SMI_CONF_DBG_H__
#include "smi_reg.h"
void __iomem *smi_mmsys_base;
#define SMI_MMSYS_DEBUG_NUM ((SMI_LARB_NUM_MAX) * 3 + 6)
u32 smi_mmsys_debug_offset[SMI_MMSYS_DEBUG_NUM] = {
MMSYS_CG_CON0, MMSYS_CG_CON1,
MMSYS_HW_DCM_1ST_DIS0, MMSYS_HW_DCM_1ST_DIS_SET0,
MMSYS_HW_DCM_2ND_DIS0, MMSYS_SW0_RST_B,
DISP_GALS_DBG(0), DISP_GALS_DBG(1), DISP_GALS_DBG(2), DISP_GALS_DBG(3),
DISP_GALS_DBG(4), DISP_GALS_DBG(5), DISP_GALS_DBG(6),
DISP_GALS_DBG(7), DISP_GALS_DBG(8), DISP_GALS_DBG(9),
DISP_GALS_DBG(10), DISP_GALS_DBG(11), DISP_GALS_DBG(12),
DISP_GALS_DBG(13), DISP_GALS_DBG(14), DISP_GALS_DBG(15),
MMSYS_GALS_DBG(0), MMSYS_GALS_DBG(1), MMSYS_GALS_DBG(2),
MMSYS_GALS_DBG(3), MMSYS_GALS_DBG(4), MMSYS_GALS_DBG(5),
MMSYS_GALS_DBG(6), MMSYS_GALS_DBG(7),
};
#define SMI_COMM_DEBUG_NUM ((SMI_LARB_NUM_MAX) * 4 + 27)
u32 smi_comm_debug_offset[SMI_COMM_DEBUG_NUM] = {
SMI_L1LEN,
SMI_L1ARB(0), SMI_L1ARB(1), SMI_L1ARB(2), SMI_L1ARB(3),
SMI_L1ARB(4), SMI_L1ARB(5), SMI_L1ARB(6), SMI_L1ARB(7),
SMI_MON_AXI_ENA, SMI_MON_AXI_CLR, SMI_MON_AXI_ACT_CNT,
SMI_BUS_SEL, SMI_WRR_REG0, SMI_WRR_REG1,
SMI_READ_FIFO_TH, SMI_M4U_TH, SMI_FIFO_TH1, SMI_FIFO_TH2,
SMI_PREULTRA_MASK0, SMI_PREULTRA_MASK1, SMI_DCM, SMI_ELA,
SMI_Mx_RWULTRA_WRRy(1, 0, 0), SMI_Mx_RWULTRA_WRRy(1, 0, 1),
SMI_Mx_RWULTRA_WRRy(1, 1, 0), SMI_Mx_RWULTRA_WRRy(1, 1, 1),
SMI_Mx_RWULTRA_WRRy(2, 0, 0), SMI_Mx_RWULTRA_WRRy(2, 0, 1),
SMI_Mx_RWULTRA_WRRy(2, 1, 0), SMI_Mx_RWULTRA_WRRy(2, 1, 1),
SMI_COMMON_CLAMP_EN, SMI_COMMON_CLAMP_EN_SET, SMI_COMMON_CLAMP_EN_CLR,
SMI_DEBUG_S(0), SMI_DEBUG_S(1), SMI_DEBUG_S(2), SMI_DEBUG_S(3),
SMI_DEBUG_S(4), SMI_DEBUG_S(5), SMI_DEBUG_S(6), SMI_DEBUG_S(7),
SMI_DEBUG_EXT(0), SMI_DEBUG_EXT(1), SMI_DEBUG_EXT(2), SMI_DEBUG_EXT(3),
SMI_DEBUG_M0, SMI_DEBUG_M1, SMI_DEBUG_EXT4, SMI_DEBUG_EXT5,
SMI_DEBUG_MISC, SMI_DUMMY, SMI_DEBUG_EXT6, SMI_DEBUG_EXT7,
SMI_AST_EN, SMI_AST_COND, SMI_TIMEOUT, SMI_TIMEOUT_CNT, SMI_AST_STA,
};
#define SMI_LARB_DEBUG_NUM ((SMI_PORT_NUM_MAX) * 4 + 31)
u32 smi_larb_debug_offset[SMI_LARB_DEBUG_NUM] = {
SMI_LARB_STAT, SMI_LARB_IRQ_STATUS, SMI_LARB_SLP_CON,
SMI_LARB_CON, SMI_LARB_CON_SET,
SMI_LARB_VC_PRI_MODE, SMI_LARB_CMD_THRT_CON,
SMI_LARB_SW_FLAG, SMI_LARB_BWL_EN, SMI_LARB_OSTDL_EN,
SMI_LARB_ULTRA_DIS, SMI_LARB_FORCE_ULTRA,
SMI_LARB_SPM_ULTRA_MASK, SMI_LARB_SPM_STA,
SMI_LARB_EXT_GREQ_VIO, SMI_LARB_INT_GREQ_VIO,
SMI_LARB_OSTD_UDF_VIO, SMI_LARB_OSTD_CRS_VIO,
SMI_LARB_FIFO_STAT, SMI_LARB_BUS_STAT, SMI_LARB_CMD_THRT_STAT,
SMI_LARB_MON_REQ, SMI_LARB_REQ_MASK,
SMI_LARB_EXT_ONGOING, SMI_LARB_INT_ONGOING, SMI_LARB_DBG_CON,
SMI_LARB_WRR_PORT(0), SMI_LARB_WRR_PORT(1), SMI_LARB_WRR_PORT(2),
SMI_LARB_WRR_PORT(3), SMI_LARB_WRR_PORT(4), SMI_LARB_WRR_PORT(5),
SMI_LARB_WRR_PORT(6), SMI_LARB_WRR_PORT(7), SMI_LARB_WRR_PORT(8),
SMI_LARB_WRR_PORT(9), SMI_LARB_WRR_PORT(10), SMI_LARB_WRR_PORT(11),
SMI_LARB_WRR_PORT(12), SMI_LARB_WRR_PORT(13), SMI_LARB_WRR_PORT(14),
SMI_LARB_WRR_PORT(15), SMI_LARB_WRR_PORT(16), SMI_LARB_WRR_PORT(17),
SMI_LARB_WRR_PORT(18), SMI_LARB_WRR_PORT(19), SMI_LARB_WRR_PORT(20),
SMI_LARB_WRR_PORT(21), SMI_LARB_WRR_PORT(22), SMI_LARB_WRR_PORT(23),
SMI_LARB_WRR_PORT(24), SMI_LARB_WRR_PORT(25), SMI_LARB_WRR_PORT(26),
SMI_LARB_WRR_PORT(27), SMI_LARB_WRR_PORT(28), SMI_LARB_WRR_PORT(29),
SMI_LARB_WRR_PORT(30), SMI_LARB_WRR_PORT(31),
SMI_LARB_OSTDL_PORT(0), SMI_LARB_OSTDL_PORT(1), SMI_LARB_OSTDL_PORT(2),
SMI_LARB_OSTDL_PORT(3), SMI_LARB_OSTDL_PORT(4), SMI_LARB_OSTDL_PORT(5),
SMI_LARB_OSTDL_PORT(6), SMI_LARB_OSTDL_PORT(7), SMI_LARB_OSTDL_PORT(8),
SMI_LARB_OSTDL_PORT(9), SMI_LARB_OSTDL_PORT(10),
SMI_LARB_OSTDL_PORT(11), SMI_LARB_OSTDL_PORT(12),
SMI_LARB_OSTDL_PORT(13), SMI_LARB_OSTDL_PORT(14),
SMI_LARB_OSTDL_PORT(15), SMI_LARB_OSTDL_PORT(16),
SMI_LARB_OSTDL_PORT(17), SMI_LARB_OSTDL_PORT(18),
SMI_LARB_OSTDL_PORT(19), SMI_LARB_OSTDL_PORT(20),
SMI_LARB_OSTDL_PORT(21), SMI_LARB_OSTDL_PORT(22),
SMI_LARB_OSTDL_PORT(23), SMI_LARB_OSTDL_PORT(24),
SMI_LARB_OSTDL_PORT(25), SMI_LARB_OSTDL_PORT(26),
SMI_LARB_OSTDL_PORT(27), SMI_LARB_OSTDL_PORT(28),
SMI_LARB_OSTDL_PORT(29), SMI_LARB_OSTDL_PORT(30),
SMI_LARB_OSTDL_PORT(31),
SMI_LARB_OSTD_MON_PORT(0), SMI_LARB_OSTD_MON_PORT(1),
SMI_LARB_OSTD_MON_PORT(2), SMI_LARB_OSTD_MON_PORT(3),
SMI_LARB_OSTD_MON_PORT(4), SMI_LARB_OSTD_MON_PORT(5),
SMI_LARB_OSTD_MON_PORT(6), SMI_LARB_OSTD_MON_PORT(7),
SMI_LARB_OSTD_MON_PORT(8), SMI_LARB_OSTD_MON_PORT(9),
SMI_LARB_OSTD_MON_PORT(10), SMI_LARB_OSTD_MON_PORT(11),
SMI_LARB_OSTD_MON_PORT(12), SMI_LARB_OSTD_MON_PORT(13),
SMI_LARB_OSTD_MON_PORT(14), SMI_LARB_OSTD_MON_PORT(15),
SMI_LARB_OSTD_MON_PORT(16), SMI_LARB_OSTD_MON_PORT(17),
SMI_LARB_OSTD_MON_PORT(18), SMI_LARB_OSTD_MON_PORT(19),
SMI_LARB_OSTD_MON_PORT(20), SMI_LARB_OSTD_MON_PORT(21),
SMI_LARB_OSTD_MON_PORT(22), SMI_LARB_OSTD_MON_PORT(23),
SMI_LARB_OSTD_MON_PORT(24), SMI_LARB_OSTD_MON_PORT(25),
SMI_LARB_OSTD_MON_PORT(26), SMI_LARB_OSTD_MON_PORT(27),
SMI_LARB_OSTD_MON_PORT(28), SMI_LARB_OSTD_MON_PORT(29),
SMI_LARB_OSTD_MON_PORT(30), SMI_LARB_OSTD_MON_PORT(31),
SMI_LARB_NON_SEC_CON(0), SMI_LARB_NON_SEC_CON(1),
SMI_LARB_NON_SEC_CON(2), SMI_LARB_NON_SEC_CON(3),
SMI_LARB_NON_SEC_CON(4), SMI_LARB_NON_SEC_CON(5),
SMI_LARB_NON_SEC_CON(6), SMI_LARB_NON_SEC_CON(7),
SMI_LARB_NON_SEC_CON(8), SMI_LARB_NON_SEC_CON(9),
SMI_LARB_NON_SEC_CON(10), SMI_LARB_NON_SEC_CON(11),
SMI_LARB_NON_SEC_CON(12), SMI_LARB_NON_SEC_CON(13),
SMI_LARB_NON_SEC_CON(14), SMI_LARB_NON_SEC_CON(15),
SMI_LARB_NON_SEC_CON(16), SMI_LARB_NON_SEC_CON(17),
SMI_LARB_NON_SEC_CON(18), SMI_LARB_NON_SEC_CON(19),
SMI_LARB_NON_SEC_CON(20), SMI_LARB_NON_SEC_CON(21),
SMI_LARB_NON_SEC_CON(22), SMI_LARB_NON_SEC_CON(23),
SMI_LARB_NON_SEC_CON(24), SMI_LARB_NON_SEC_CON(25),
SMI_LARB_NON_SEC_CON(26), SMI_LARB_NON_SEC_CON(27),
SMI_LARB_NON_SEC_CON(28), SMI_LARB_NON_SEC_CON(29),
SMI_LARB_NON_SEC_CON(30), SMI_LARB_NON_SEC_CON(31),
SMI_LARB_MON_EN, SMI_LARB_MON_CLR, SMI_LARB_MON_ACT_CNT,
INT_SMI_LARB_CMD_THRT_CON, INT_SMI_LARB_DBG_CON,
};
#endif
File diff suppressed because it is too large. Load diff
+35
View File
@@ -0,0 +1,35 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_PMQOS_H__
#define __SMI_PMQOS_H__
#include <smi_port.h>
#define SMI_PMQOS_BWL_MAX (0xfff)
#define SMI_PMQOS_BWL_MASK(b) \
((b) > (SMI_PMQOS_BWL_MAX) ? (SMI_PMQOS_BWL_MAX) : (b))
#if IS_ENABLED(PMQOS_USE_IOMMU_PORT)
#define SMI_PMQOS_PORT_MASK(p) MTK_IOMMU_TO_PORT(p)
#define SMI_PMQOS_LARB_DEC(l) MTK_IOMMU_TO_LARB(l)
#define SMI_PMQOS_ENC(l, p) MTK_M4U_ID(l, p)
#else
#define SMI_PMQOS_PORT_MASK(p) ((p) & 0xffff)
#define SMI_PMQOS_LARB_DEC(l) ((l) >> 16)
#define SMI_PMQOS_LARB_ENC(l) ((l) << 16)
#define SMI_PMQOS_ENC(l, p) (SMI_PMQOS_LARB_ENC(l) | SMI_PMQOS_PORT_MASK(p))
#endif
#if IS_ENABLED(CONFIG_MTK_SMI_EXT)
void
smi_bwl_update(const u32 id, const u32 bwl, const bool soft, const char *user);
void smi_ostd_update(const struct plist_head *head, const char *user);
#else
#define smi_bwl_update(id, bwl, soft, user) ((void)0)
#define smi_ostd_update(head, user) ((void)0)
#endif
#endif
+36
View File
@@ -0,0 +1,36 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_PUBLIC_H__
#define __SMI_PUBLIC_H__
#if IS_ENABLED(CONFIG_MTK_SMI_EXT)
#if IS_ENABLED(CONFIG_MACH_MT6885)
#include "mt6885/smi_port.h"
#endif
enum {
SMI_LARB0, SMI_LARB1, SMI_LARB2, SMI_LARB3, SMI_LARB4,
SMI_LARB5, SMI_LARB6, SMI_LARB7, SMI_LARB8, SMI_LARB9,
SMI_LARB10, SMI_LARB11, SMI_LARB12, SMI_LARB13, SMI_LARB14,
SMI_LARB15, SMI_LARB16, SMI_LARB17, SMI_LARB18, SMI_LARB19,
SMI_LARB20,
};
bool smi_mm_first_get(void);
s32 smi_bus_prepare_enable(const u32 id, const char *user);
s32 smi_bus_disable_unprepare(const u32 id, const char *user);
s32 smi_debug_bus_hang_detect(const bool gce, const char *user);
s32 smi_sysram_enable(const u32 master_id, const bool enable, const char *user);
#else
#define smi_mm_first_get() (true)
#define smi_bus_prepare_enable(id, user) ((void)0)
#define smi_bus_disable_unprepare(id, user) ((void)0)
#define smi_debug_bus_hang_detect(gce, user) ((void)0)
#define smi_sysram_enable(master_id, enable, user) ((void)0)
#endif
#endif
+153
View File
@@ -0,0 +1,153 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#ifndef __SMI_REG_H__
#define __SMI_REG_H__
#define SMI_LARB_NUM_MAX (1 << 3)
#define SMI_PORT_NUM_MAX (1 << 5)
/* MMSYS */
#define MMSYS_CG_CON0 (0x100)
#define MMSYS_CG_CON1 (0x110)
#define MMSYS_HW_DCM_1ST_DIS0 (0x120)
#define MMSYS_HW_DCM_1ST_DIS_SET0 (0x124)
#define MMSYS_HW_DCM_2ND_DIS0 (0x130)
#define MMSYS_SW0_RST_B (0x140)
#define DISP_GALS_DBG(x) (0x520 + ((x) << 2))
#define MMSYS_GALS_DBG(x) (0x914 + ((x) << 2))
/* COMM */
#define SMI_L1LEN (0x100)
#define SMI_L1ARB(master) (0x104 + ((master) << 2))
#define SMI_MON_AXI_ENA (0x1a0)
#define SMI_MON_AXI_CLR (0x1a4)
#define SMI_MON_AXI_ACT_CNT (0x1c0)
#define SMI_BUS_SEL (0x220)
#define SMI_WRR_REG0 (0x228)
#define SMI_WRR_REG1 (0x22c)
#define SMI_READ_FIFO_TH (0x230)
#define SMI_M4U_TH (0x234)
#define SMI_FIFO_TH1 (0x238)
#define SMI_FIFO_TH2 (0x23c)
#define SMI_PREULTRA_MASK0 (0x240)
#define SMI_PREULTRA_MASK1 (0x244)
#define SMI_DCM (0x300)
#define SMI_ELA (0x304)
#define SMI_Mx_RWULTRA_WRRy(x, rw, y) \
(0x308 + (((x) - 1) << 4) + ((rw) << 3) + ((y) << 2))
#define SMI_COMMON_CLAMP_EN (0x3c0)
#define SMI_COMMON_CLAMP_EN_SET (0x3c4)
#define SMI_COMMON_CLAMP_EN_CLR (0x3c8)
#define SMI_DEBUG_S(slave) (0x400 + ((slave) << 2))
#define SMI_DEBUG_EXT(slave) (0x420 + ((slave) << 2))
#define SMI_DEBUG_M0 (0x430)
#define SMI_DEBUG_M1 (0x434)
#define SMI_DEBUG_EXT4 (0x438)
#define SMI_DEBUG_EXT5 (0x43c)
#define SMI_DEBUG_MISC (0x440)
#define SMI_DUMMY (0x444)
#define SMI_DEBUG_EXT6 (0x448)
#define SMI_DEBUG_EXT7 (0x44c)
#define SMI_AST_EN (0x700)
#define SMI_AST_CLR (0x704)
#define SMI_SW_TRIG (0x708)
#define SMI_AST_COND (0x70c)
#define SMI_TIMEOUT (0x710)
#define SMI_TIMEOUT_CNT (0x714)
#define SMI_AST_STA (0x718)
#define SMI_AST_STA_CLR (0x71c)
/* LARB */
#define SMI_LARB_STAT (0x0)
#define SMI_LARB_IRQ_EN (0x4)
#define SMI_LARB_IRQ_STATUS (0x8)
#define SMI_LARB_SLP_CON (0xc)
#define SMI_LARB_CON (0x10)
#define SMI_LARB_CON_SET (0x14)
#define SMI_LARB_CON_CLR (0x18)
#define SMI_LARB_VC_PRI_MODE (0x20)
#define SMI_LARB_CMD_THRT_CON (0x24)
#define SMI_LARB_SW_FLAG (0x40)
#define SMI_LARB_BWL_EN (0x50)
#define SMI_LARB_BWL_CON (0x58)
#define SMI_LARB_OSTDL_EN (0x60)
#define SMI_LARB_ULTRA_DIS (0x70)
#define SMI_LARB_PREULTRA_DIS (0x74)
#define SMI_LARB_FORCE_ULTRA (0x78)
#define SMI_LARB_FORCE_PREULTRA (0x7c)
#define SMI_LARB_SPM_ULTRA_MASK (0x80)
#define SMI_LARB_SPM_STA (0x84)
#define SMI_LARB_EXT_GREQ_VIO (0xa0)
#define SMI_LARB_INT_GREQ_VIO (0xa4)
#define SMI_LARB_OSTD_UDF_VIO (0xa8)
#define SMI_LARB_OSTD_CRS_VIO (0xac)
#define SMI_LARB_FIFO_STAT (0xb0)
#define SMI_LARB_BUS_STAT (0xb4)
#define SMI_LARB_CMD_THRT_STAT (0xb8)
#define SMI_LARB_MON_REQ (0xbc)
#define SMI_LARB_REQ_MASK (0xc0)
#define SMI_LARB_REQ_DET (0xc4)
#define SMI_LARB_EXT_ONGOING (0xc8)
#define SMI_LARB_INT_ONGOING (0xcc)
#define SMI_LARB_DBG_CON (0xf0)
#define SMI_LARB_WRR_PORT(p) (0x100 + ((p) << 2))
#define SMI_LARB_OSTDL_PORT(p) (0x200 + ((p) << 2))
#define SMI_LARB_OSTD_MON_PORT(p) (0x280 + ((p) << 2))
#define SMI_LARB_NON_SEC_CON(p) (0x380 + ((p) << 2))
#define SMI_LARB_MON_EN (0x400)
#define SMI_LARB_MON_CLR (0x404)
#define SMI_LARB_MON_PORT (0x408)
#define SMI_LARB_MON_CON (0x40c)
#define SMI_LARB_MON_ACT_CNT (0x410)
#define SMI_LARB_MON_REQ_CNT (0x414)
#define SMI_LARB_MON_BEAT_CNT (0x418)
#define SMI_LARB_MON_BYTE_CNT (0x41c)
#define INT_SMI_LARB_CMD_THRT_CON (0x500 + (SMI_LARB_CMD_THRT_CON))
#define INT_SMI_LARB_DBG_CON (0x500 + (SMI_LARB_DBG_CON))
#define INT_SMI_LARB_OSTD_MON_PORT(p) (0x500 + SMI_LARB_OSTD_MON_PORT(p))
/* RSI */
#define RSI_INTLV_CON (0x0)
#define RSI_DCM_CON (0x4)
#define RSI_DS_PM_CON (0x8)
#define RSI_MISC_CON (0xc)
#define RSI_STA (0x10)
#define RSI_AWOSTD_S (0x80)
#define RSI_AWOSTD_M0 (0x84)
#define RSI_AWOSTD_M1 (0x88)
#define RSI_AWOSTD_PSEUDO (0x8c)
#define RSI_WOSTD_S (0x90)
#define RSI_WOSTD_M0 (0x94)
#define RSI_WOSTD_M1 (0x98)
#define RSI_WOSTD_PSEUDO (0x9c)
#define RSI_AROSTD_S (0xa0)
#define RSI_AROSTD_M0 (0xa4)
#define RSI_AROSTD_M1 (0xa8)
#define RSI_AROSTD_PSEUDO (0xac)
#define RSI_WLAST_OWE_CNT_S (0xb0)
#define RSI_WLAST_OWE_CNT_M0 (0xb4)
#define RSI_WLAST_OWE_CNT_M1 (0xb8)
#define RSI_WDAT_CNT_S (0xc0)
#define RSI_WDAT_CNT_M0 (0xc4)
#define RSI_WDAT_CNT_M1 (0xc8)
#define RSI_RDAT_CNT_S (0xd0)
#define RSI_RDAT_CNT_M0 (0xd4)
#define RSI_RDAT_CNT_M1 (0xd8)
#define RSI_AXI_DBG_S (0xf0)
#define RSI_AXI_DBG_M0 (0xf4)
#define RSI_AXI_DBG_M1 (0xf8)
#endif
@@ -0,0 +1,22 @@
#
# Copyright (C) 2015 MediaTek Inc.
#
# 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
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat
ccflags-y += -I$(srctree)/drivers/misc/mediatek/m4u/$(MTK_PLATFORM)/
ifeq ($(CONFIG_MACH_MT8173),y)
ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include
ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
endif
obj-y += smi_variant.o
obj-y += smi_variant_config_8173.o
@@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2020 MediaTek Inc.
*/
#ifndef __SMI_COMMON_H__
#define __SMI_COMMON_H__
#define SMI_CLIENT_DISP 0
#define SMI_CLIENT_WFD 1
#define SMI_EVENT_DIRECT_LINK (0x1 << 0)
#define SMI_EVENT_DECOUPLE (0x1 << 1)
#define SMI_EVENT_OVL_CASCADE (0x1 << 2)
#define SMI_EVENT_OVL1_EXTERNAL (0x1 << 3)
extern char *smi_port_name[][21];
/* for slow motion force 30 fps */
extern int primary_display_force_set_vsync_fps(unsigned int fps);
extern unsigned int primary_display_get_fps(void);
extern void smi_dumpDebugMsg(void);
extern void smi_client_status_change_notify(int module, int mode);
extern void SMI_DBG_Init(void);
void register_base_dump(void);
#endif
@@ -0,0 +1,52 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2020 MediaTek Inc.
*/
#ifndef __SMI_PRIV_H__
#define __SMI_PRIV_H__
#include "smi_reg.h"
#define SMI_LARB_PORT_NR_MAX 21/* Max port num in current platform.*/
struct mtk_smi_priv;
enum mtk_platform {
MTK_PLAT_MT8173,
MTK_PLAT_MT8163,
MTK_PLAT_MT8127,
MTK_PLAT_MT8167,
MTK_PLAT_MAX
};
struct mtk_smi_data {
unsigned int larb_nr;
struct device *larb[SMI_LARB_NR_MAX];
struct device *smicommon;
const struct mtk_smi_priv *smi_priv;
unsigned long smi_common_base;
unsigned long larb_base[SMI_LARB_NR_MAX];
int larbref[SMI_LARB_NR_MAX];
/*record the larb port register, please use the max value*/
unsigned short int
larb_port_backup[SMI_LARB_PORT_NR_MAX * SMI_LARB_NR_MAX];
};
struct mtk_smi_priv {
enum mtk_platform plat;
/* the port number in each larb */
unsigned int larb_port_num[SMI_LARB_NR_MAX];
unsigned char larb_vc_setting[SMI_LARB_NR_MAX];
void (*init_setting)(struct mtk_smi_data *smidev, bool *default_saved,
u32 *default_smi_val, unsigned int larbid);
void (*vp_setting)(struct mtk_smi_data *smidev);
void (*vp_wfd_setting)(struct mtk_smi_data *smidev);
void (*vr_setting)(struct mtk_smi_data *smidev);
void (*hdmi_setting)(struct mtk_smi_data *smidev);
void (*hdmi_4k_setting)(struct mtk_smi_data *smidev);
};
extern const struct mtk_smi_priv smi_mt8173_priv;
#endif
+450
View File
@@ -0,0 +1,450 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2020 MediaTek Inc.
*/
#ifndef _SMI_REG_H__
#define _SMI_REG_H__
extern struct mtk_smi_data *smi_data;
#define LARB0_BASE smi_data->larb_base[0]
#define LARB1_BASE smi_data->larb_base[1]
#define LARB2_BASE smi_data->larb_base[2]
#define LARB3_BASE smi_data->larb_base[3]
#define LARB4_BASE smi_data->larb_base[4]
#define LARB5_BASE smi_data->larb_base[5]
#define SMI_COMMON_EXT_BASE smi_data->smi_common_base
/* ================================================= */
/* common macro definitions */
#define F_VAL(val, msb, lsb) (((val)&((1<<(msb-lsb+1))-1))<<lsb)
#define F_MSK(msb, lsb) F_VAL(0xffffffff, msb, lsb)
#define F_BIT_SET(bit) (1<<(bit))
#define F_BIT_VAL(val, bit) ((!!(val))<<(bit))
#define F_MSK_SHIFT(regval, msb, lsb) (((regval)&F_MSK(msb, lsb))>>lsb)
/* ===================================================== */
/* M4U register definition */
/* ===================================================== */
#define REG_MMUg_PT_BASE (0x0)
#define F_MMUg_PT_VA_MSK 0xffff0000
#define REG_MMUg_PT_BASE_SEC (0x4)
#define F_MMUg_PT_VA_MSK_SEC 0xffff0000
#define REG_MMU_PROG_EN 0x10
#define F_MMU0_PROG_EN 1
#define F_MMU1_PROG_EN 2
#define REG_MMU_PROG_VA 0x14
#define F_PROG_VA_LOCK_BIT (1<<11)
#define F_PROG_VA_LAYER_BIT F_BIT_SET(9)
#define F_PROG_VA_SIZE16X_BIT F_BIT_SET(8)
#define F_PROG_VA_SECURE_BIT (1<<7)
#define F_PROG_VA_MASK 0xfffff000
#define REG_MMU_PROG_DSC 0x18
#define REG_MMU_INVLD (0x20)
#define F_MMU_INV_ALL 0x2
#define F_MMU_INV_RANGE 0x1
#define REG_MMU_INVLD_SA (0x24)
#define REG_MMU_INVLD_EA (0x28)
#define REG_MMU_INVLD_SEC (0x2c)
#define F_MMU_INV_SEC_ALL 0x2
#define F_MMU_INV_SEC_RANGE 0x1
#define REG_MMU_INVLD_SA_SEC (0x30)
#define REG_MMU_INVLD_EA_SEC (0x34)
#define REG_INVLID_SEL (0x38)
#define F_MMU_INV_EN_L1 (1<<0)
#define F_MMU_INV_EN_L2 (1<<1)
#define REG_INVLID_SEL_SEC (0x3c)
#define F_MMU_INV_SEC_EN_L1 (1<<0)
#define F_MMU_INV_SEC_EN_L2 (1<<1)
#define F_MMU_INV_SEC_INV_DONE (1<<2)
#define F_MMU_INV_SEC_INV_INT_SET (1<<3)
#define F_MMU_INV_SEC_INV_INT_CLR (1<<4)
#define F_MMU_INV_SEC_DBG (1<<5)
#define REG_MMU_SEC_ABORT_INFO (0x40)
#define REG_MMU_STANDARD_AXI_MODE (0x48)
#define REG_MMU_PRIORITY (0x4c)
#define REG_MMU_DCM_DIS (0x50)
#define REG_MMU_WR_LEN (0x54)
#define REG_MMU_HW_DEBUG (0x58)
#define F_MMU_HW_DBG_L2_SCAN_ALL F_BIT_SET(1)
#define F_MMU_HW_DBG_PFQ_BRDCST F_BIT_SET(0)
#define REG_MMU_NON_BLOCKING_DIS 0x5C
#define F_MMU_NON_BLOCK_DISABLE_BIT 1
#define F_MMU_NON_BLOCK_HALF_ENTRY_BIT 2
#define REG_MMU_LEGACY_4KB_MODE (0x60)
#define REG_MMU_PFH_DIST0 0x80
#define REG_MMU_PFH_DIST1 0x84
#define REG_MMU_PFH_DIST2 0x88
#define REG_MMU_PFH_DIST3 0x8c
#define REG_MMU_PFH_DIST4 0x90
#define REG_MMU_PFH_DIST5 0x94
#define REG_MMU_PFH_DIST6 0x98
#define REG_MMU_PFH_DIST(port) (0x80+(((port)>>3)<<2))
#define F_MMU_PFH_DIST_VAL(port, val) ((val&0xf)<<(((port)&0x7)<<2))
#define F_MMU_PFH_DIST_MASK(port) F_MMU_PFH_DIST_VAL((port), 0xf)
#define REG_MMU_PFH_DIR0 0xF0
#define REG_MMU_PFH_DIR1 0xF4
#define REG_MMU_PFH_DIR(port) \
(((port) < 32) ? REG_MMU_PFH_DIR0 : REG_MMU_PFH_DIR1)
#define F_MMU_PFH_DIR(port, val) ((!!(val))<<((port)&0x1f))
#define REG_MMU_READ_ENTRY 0x100
#define F_READ_ENTRY_EN F_BIT_SET(31)
#define F_READ_ENTRY_MM1_MAIN F_BIT_SET(26)
#define F_READ_ENTRY_MM0_MAIN F_BIT_SET(25)
#define F_READ_ENTRY_MMx_MAIN(id) F_BIT_SET(25+id)
#define F_READ_ENTRY_PFH F_BIT_SET(24)
#define F_READ_ENTRY_MAIN_IDX(idx) F_VAL(idx, 21, 16)
#define F_READ_ENTRY_PFH_IDX(idx) F_VAL(idx, 11, 5)
/* #define F_READ_ENTRY_PFH_HI_LO(high) F_VAL(high, 4,4) */
/* #define F_READ_ENTRY_PFH_PAGE(page) F_VAL(page, 3,2) */
#define F_READ_ENTRY_PFH_PAGE_IDX(idx) F_VAL(idx, 4, 2)
#define F_READ_ENTRY_PFH_WAY(way) F_VAL(way, 1, 0)
#define REG_MMU_DES_RDATA 0x104
#define REG_MMU_PFH_TAG_RDATA 0x108
#define F_PFH_TAG_VA_GET(mmu, tag) \
(F_MSK_SHIFT(tag, 14, 4)<<(MMU_SET_MSB_OFFSET(mmu)+1))
#define F_PFH_TAG_LAYER_BIT F_BIT_SET(3)
#define F_PFH_TAG_16X_BIT F_BIT_SET(2)
#define F_PFH_TAG_SEC_BIT F_BIT_SET(1)
#define F_PFH_TAG_AUTO_PFH F_BIT_SET(0)
/* tag related macro */
/* #define MMU0_SET_ORDER 7 */
/* #define MMU1_SET_ORDER 6 */
#define MMU_SET_ORDER(mmu) (7-(mmu))
#define MMU_SET_NR(mmu) (1<<MMU_SET_ORDER(mmu))
#define MMU_SET_LSB_OFFSET 15
#define MMU_SET_MSB_OFFSET(mmu) \
(MMU_SET_LSB_OFFSET+MMU_SET_ORDER(mmu)-1)
#define MMU_PFH_VA_TO_SET(mmu, va) \
F_MSK_SHIFT(va, MMU_SET_MSB_OFFSET(mmu), \
MMU_SET_LSB_OFFSET)
#define MMU_PAGE_PER_LINE 8
#define MMU_WAY_NR 4
#define MMU_PFH_TOTAL_LINE(mmu) (MMU_SET_NR(mmu)*MMU_WAY_NR)
#define REG_MMU_CTRL_REG 0x110
#define F_MMU_CTRL_PFH_DIS(dis) F_BIT_VAL(dis, 0)
#define F_MMU_CTRL_TLB_WALK_DIS(dis) F_BIT_VAL(dis, 1)
#define F_MMU_CTRL_MONITOR_EN(en) F_BIT_VAL(en, 2)
#define F_MMU_CTRL_MONITOR_CLR(clr) F_BIT_VAL(clr, 3)
#define F_MMU_CTRL_PFH_RT_RPL_MODE(mod) F_BIT_VAL(mod, 4)
#define F_MMU_CTRL_TF_PROT_VAL(prot) F_VAL(prot, 6, 5)
#define F_MMU_CTRL_TF_PROT_MSK F_MSK(6, 5)
#define F_MMU_CTRL_INT_HANG_en(en) F_BIT_VAL(en, 7)
#define F_MMU_CTRL_COHERE_EN(en) F_BIT_VAL(en, 8)
#define F_MMU_CTRL_IN_ORDER_WR(en) F_BIT_VAL(en, 9)
#define F_MMU_CTRL_MAIN_TLB_SHARE_ALL(en) F_BIT_VAL(en, 10)
#define REG_MMU_IVRP_PADDR 0x114
#define F_MMU_IVRP_PA_SET(PA) (PA>>1)
#define F_MMU_IVRP_8G_PA_SET(PA) ((PA>>1)|(1<<31))
#define REG_MMU_INT_L2_CONTROL 0x120
#define F_INT_L2_CLR_BIT (1<<12)
#define F_INT_L2_MULTI_HIT_FAULT F_BIT_SET(0)
#define F_INT_L2_TABLE_WALK_FAULT F_BIT_SET(1)
#define F_INT_L2_PFH_DMA_FIFO_OVERFLOW F_BIT_SET(2)
#define F_INT_L2_MISS_DMA_FIFO_OVERFLOW F_BIT_SET(3)
#define F_INT_L2_INVALID_DONE F_BIT_SET(4)
#define F_INT_L2_PFH_IN_OUT_FIFO_ERROR F_BIT_SET(5)
#define F_INT_L2_MISS_FIFO_ERR F_BIT_SET(6)
#define REG_MMU_INT_MAIN_CONTROL 0x124
#define F_INT_TRANS_F(MMU) \
F_BIT_SET(0+(((MMU)<<1)|((MMU)<<2)))
#define F_INT_MAIN_MULTI_HIT_FAULT(MMU) \
F_BIT_SET(1+(((MMU)<<1)|((MMU)<<2)))
#define F_INT_INVALID_PA_F(MMU) \
F_BIT_SET(2+(((MMU)<<1)|((MMU)<<2)))
#define F_INT_ENTRY_REPLACEMENT_FAULT(MMU) \
F_BIT_SET(3+(((MMU)<<1)|((MMU)<<2)))
#define F_INT_TLB_MISS_FAULT(MMU) \
F_BIT_SET(5+(((MMU)<<1)|((MMU)<<2)))
#define F_INT_PFH_FIFO_ERR(MMU) \
F_BIT_SET(6+(((MMU)<<1)|((MMU)<<2)))
#define F_INT_MAU(mmu, set) \
F_BIT_SET(14+(set)+(mmu<<2))
#define F_INT_MMU0_MAIN_MSK F_MSK(6, 0)
#define F_INT_MMU1_MAIN_MSK F_MSK(13, 7)
#define F_INT_MMU0_MAU_MSK F_MSK(17, 14)
#define F_INT_MMU1_MAU_MSK F_MSK(21, 18)
#define REG_MMU_CPE_DONE_SEC 0x128
#define REG_MMU_CPE_DONE 0x12C
#define REG_MMU_L2_FAULT_ST 0x130
#define F_INT_L2_MISS_OUT_FIFO_ERROR F_BIT_SET(7)
#define F_INT_L2_MISS_IN_FIFO_ERR F_BIT_SET(8)
#define REG_MMU_MAIN_FAULT_ST 0x134
#define REG_MMU_TBWALK_FAULT_VA 0x138
#define F_MMU_TBWALK_FAULT_VA_MSK F_MSK(31, 12)
#define F_MMU_TBWALK_FAULT_LAYER(regval) F_MSK_SHIFT(regval, 0, 0)
#define REG_MMU_FAULT_VA(mmu) (0x13c+((mmu)<<3))
#define F_MMU_FAULT_VA_MSK F_MSK(31, 12)
#define F_MMU_FAULT_VA_WRITE_BIT F_BIT_SET(1)
#define F_MMU_FAULT_VA_LAYER_BIT F_BIT_SET(0)
#define REG_MMU_INVLD_PA(mmu) (0x140+((mmu)<<3))
#define REG_MMU_INT_ID(mmu) (0x150+((mmu)<<2))
#define REG_MMU_PF_MSCNT 0x160
#define REG_MMU_PF_CNT 0x164
#define REG_MMU_ACC_CNT(mmu) (0x168+(((mmu)<<3)|((mmu)<<2)))
#define REG_MMU_MAIN_MSCNT(mmu) (0x16c+(((mmu)<<3)|((mmu)<<2)))
#define REG_MMU_RS_PERF_CNT(mmu) (0x170+(((mmu)<<3)|((mmu)<<2)))
#define MMU01_SQ_OFFSET (0x600-0x300)
#define REG_MMU_SQ_START(mmu, x) \
(0x300+((x)<<3)+((mmu)*MMU01_SQ_OFFSET))
#define F_SQ_VA_MASK F_MSK(31, 18)
#define F_SQ_EN_BIT (1<<17)
/* #define F_SQ_MULTI_ENTRY_VAL(x) (((x)&0xf)<<13) */
#define REG_MMU_SQ_END(mmu, x) \
(0x304+((x)<<3)+((mmu)*MMU01_SQ_OFFSET))
#define MMU_TOTAL_RS_NR 8
#define REG_MMU_RSx_VA(mmu, x) \
(0x380+((x)<<4)+((mmu)*MMU01_SQ_OFFSET))
#define F_MMU_RSx_VA_GET(regval) \
((regval)&F_MSK(31, 12))
#define F_MMU_RSx_VA_VALID(regval) \
F_MSK_SHIFT(regval, 11, 11)
#define F_MMU_RSx_VA_PID(regval) \
F_MSK_SHIFT(regval, 9, 0)
#define REG_MMU_RSx_PA(mmu, x) \
(0x384+((x)<<4)+((mmu)*MMU01_SQ_OFFSET))
#define F_MMU_RSx_PA_GET(regval) \
((regval)&F_MSK(31, 12))
#define F_MMU_RSx_PA_VALID(regval) \
F_MSK_SHIFT(regval, 1, 0)
#define REG_MMU_RSx_2ND_BASE(mmu, x) \
(0x388+((x)<<4)+((mmu)*MMU01_SQ_OFFSET))
#define REG_MMU_RSx_ST(mmu, x) \
(0x38c+((x)<<4)+((mmu)*MMU01_SQ_OFFSET))
#define F_MMU_RSx_ST_LID(regval) F_MSK_SHIFT(regval, 21, 20)
#define F_MMU_RSx_ST_WRT(regval) F_MSK_SHIFT(regval, 12, 12)
#define F_MMU_RSx_ST_OTHER(regval) F_MSK_SHIFT(regval, 8, 0)
#define REG_MMU_MAIN_TAG(mmu, x) \
(0x500+((x)<<2)+((mmu)*MMU01_SQ_OFFSET))
#define F_MAIN_TLB_VA_MSK F_MSK(31, 12)
#define F_MAIN_TLB_LOCK_BIT (1<<11)
#define F_MAIN_TLB_VALID_BIT (1<<10)
#define F_MAIN_TLB_LAYER_BIT F_BIT_SET(9)
#define F_MAIN_TLB_16X_BIT F_BIT_SET(8)
#define F_MAIN_TLB_SEC_BIT F_BIT_SET(7)
#define F_MAIN_TLB_INV_DES_BIT (1<<6)
#define F_MAIN_TLB_SQ_EN_BIT (1<<5)
#define F_MAIN_TLB_SQ_INDEX_MSK F_MSK(4, 1)
#define F_MAIN_TLB_SQ_INDEX_GET(regval) F_MSK_SHIFT(regval, 4, 1)
#define REG_MMU_MAU_START(mmu, mau) \
(0x900+((mau)*0x20)+((mmu)*0xa0))
#define REG_MMU_MAU_START_BIT32(mmu, mau) \
(0x904+((mau)*0x20)+((mmu)*0xa0))
#define REG_MMU_MAU_END(mmu, mau) \
(0x908+((mau)*0x20)+((mmu)*0xa0))
#define REG_MMU_MAU_END_BIT32(mmu, mau) \
(0x90C+((mau)*0x20)+((mmu)*0xa0))
#define REG_MMU_MAU_PORT_EN(mmu, mau) \
(0x910+((mau)*0x20)+((mmu)*0xa0))
#define REG_MMU_MAU_ASSERT_ID(mmu, mau) \
(0x914+((mau)*0x20)+((mmu)*0xa0))
#define REG_MMU_MAU_ADDR(mmu, mau) \
(0x918+((mau)*0x20)+((mmu)*0xa0))
#define REG_MMU_MAU_ADDR_BIT32(mmu, mau) \
(0x91C+((mau)*0x20)+((mmu)*0xa0))
#define REG_MMU_MAU_LARB_EN(mmu) (0x980+((mmu)*0xa0))
#define F_MAU_LARB_VAL(mau, larb) ((larb)<<(mau*8))
#define F_MAU_LARB_MSK(mau) (0xff<<(mau*8))
#define REG_MMU_MAU_CLR(mmu) (0x984+((mmu)*0xa0))
#define REG_MMU_MAU_IO(mmu) (0x988+((mmu)*0xa0))
#define F_MAU_BIT_VAL(val, mau) F_BIT_VAL(val, mau)
#define REG_MMU_MAU_RW(mmu) (0x98c+((mmu)*0xa0))
#define REG_MMU_MAU_VA(mmu) (0x990+((mmu)*0xa0))
#define REG_MMU_MAU_ASSERT_ST(mmu) (0x994+((mmu)*0xa0))
#define REG_MMU_PFH_VLD_0 (0x180)
#define REG_MMU_PFH_VLD(set, way) \
(REG_MMU_PFH_VLD_0+(((set)>>5)<<2)+((way)<<4))
#define F_MMU_PFH_VLD_BIT(set, way) \
F_BIT_SET((set)&0x1f) /* set%32 */
/* ================================================================ */
/* SMI larb */
/* ================================================================ */
#define SMI_ERROR_ADDR 0
#define SMI_LARB_NR_MAX 6
#define SMI_LARB_STAT (0x0)
#define SMI_LARB_IRQ_EN (0x4)
#define SMI_LARB_IRQ_STATUS (0x8)
#define SMI_LARB_SLP_CON (0xc)
#define SMI_LARB_CON (0x10)
#define SMI_LARB_CON_SET (0x14)
#define SMI_LARB_CON_CLR (0x18)
#define SMI_LARB_VC_PRI_MODE (0x20)
#define SMI_LARB_CMD_THRT_CON (0x24)
#define SMI_LARB_STARV_CON (0x28)
#define SMI_LARB_EMI_CON (0x2C)
#define SMI_LARB_SHARE_EN (0x30)
#define SMI_LARB_BWL_EN (0x50)
#define SMI_LARB_BWL_SOFT_EN (0x54)
#define SMI_LARB_BWL_CON (0x58)
#define SMI_LARB_OSTDL_EN (0x60)
#define SMI_LARB_OSTDL_SOFT_EN (0x64)
#define SMI_LARB_ULTRA_DIS (0x70)
#define SMI_LARB_PREULTRA_DIS (0x74)
#define SMI_LARB_FORCE_ULTRA (0x78)
#define SMI_LARB_FORCE_PREULTRA (0x7c)
#define SMI_LARB_MST_GRP_SEL_L (0x80)
#define SMI_LARB_MST_GRP_SEL_H (0x84)
#define SMI_LARB_INT_PATH_SEL (0x90)
#define SMI_LARB_EXT_GREQ_VIO (0xa0)
#define SMI_LARB_INT_GREQ_VIO (0xa4)
#define SMI_LARB_OSTD_UDF_VIO (0xa8)
#define SMI_LARB_OSTD_CRS_VIO (0xac)
#define SMI_LARB_FIFO_STAT (0xb0)
#define SMI_LARB_BUS_STAT (0xb4)
#define SMI_LARB_CMD_THRT_STAT (0xb8)
#define SMI_LARB_MON_REQ (0xbc)
#define SMI_LARB_REQ_MASK (0xc0)
#define SMI_LARB_REQ_DET (0xc4)
#define SMI_LARB_EXT_ONGOING (0xc8)
#define SMI_LARB_INT_ONGOING (0xcc)
#define SMI_LARB_MISC_MON0 (0xd0)
#define SMI_LARB_DBG_CON (0xf0)
#define SMI_LARB_TST_MODE (0xf4)
#define SMI_LARB_WRR_PORT (0x100)
#define SMI_LARB_BWL_PORT (0x180)
#define SMI_LARB_OSTDL_PORT (0x200)
#define SMI_LARB_OSTD_MON_PORT (0x280)
#define SMI_LARB_PINFO (0x300)
#define SMI_LARB_MON_EN (0x400)
#define SMI_LARB_MON_CLR (0x404)
#define SMI_LARB_MON_PORT (0x408)
#define SMI_LARB_MON_CON (0x40c)
#define SMI_LARB_MON_ACT_CNT (0x410)
#define SMI_LARB_MON_REQ_CNT (0x414)
#define SMI_LARB_MON_BEAT_CNT (0x418)
#define SMI_LARB_MON_BYTE_CNT (0x41c)
#define SMI_LARB_MON_CP_CNT (0x420)
#define SMI_LARB_MON_DP_CNT (0x424)
#define SMI_LARB_MON_OSTD_CNT (0x428)
#define SMI_LARB_MON_CP_MAX (0x430)
#define SMI_LARB_MON_COS_MAX (0x434)
#define SMI_LARB_MMU_EN (0xf00)
#define F_SMI_MMU_EN(port, en) ((en)<<((port)))
#define F_SMI_SEC_EN(port, en) ((en)<<((port)))
#define REG_SMI_LARB_DOMN_OF_PORT(port) \
(((port) > 15) ? 0xf0c : 0xf08)
#define F_SMI_DOMN(port, domain) \
(((domain)&0x3)<<((((port) > 15)?(port-16) : port)<<1))
/*
* for 73,63 and 27, they have the same register offset,
* since those are only used when smi_variant was configed,
* so it's OK for we remove the original define
*/
#define REG_OFFSET_SMI_L1LEN (0x200)
#define REG_OFFSET_SMI_L1ARB0 (0x204)
#define REG_OFFSET_SMI_L1ARB1 (0x208)
#define REG_OFFSET_SMI_L1ARB2 (0x20C)
#define REG_OFFSET_SMI_L1ARB3 (0x210)
#define REG_OFFSET_SMI_L1ARB4 (0x214)
#define REG_OFFSET_SMI_L1ARB5 (0x218)
#define REG_SMI_M4U_TH (0x234 + SMI_COMMON_EXT_BASE)
#define REG_SMI_L1LEN (0x200 + SMI_COMMON_EXT_BASE)
#define REG_SMI_L1ARB0 (0x204 + SMI_COMMON_EXT_BASE)
#define REG_SMI_L1ARB1 (0x208 + SMI_COMMON_EXT_BASE)
#define REG_SMI_L1ARB2 (0x20C + SMI_COMMON_EXT_BASE)
#define REG_SMI_WRR_REG0 (0x228 + SMI_COMMON_EXT_BASE)
#define REG_SMI_READ_FIFO_TH (0x230 + SMI_COMMON_EXT_BASE)
/* ========================================================================= */
/* peripheral system */
/* ========================================================================= */
#define REG_PERIAXI_BUS_CTL3 (0x208+0xf0003000)
#define F_PERI_MMU_EN(port, en) ((en)<<((port)))
static inline unsigned int M4U_ReadReg32(
unsigned long M4uBase, unsigned long Offset)
{
unsigned int val;
val = ioread32((void *)(M4uBase + Offset));
return val;
}
static inline void M4U_WriteReg32(
unsigned long M4uBase, unsigned long Offset,
unsigned int Val)
{
/* unsigned int read; */
iowrite32(Val, (void *)(M4uBase + Offset));
/* make sure memory manipulation sequence is OK */
mb();
}
static inline unsigned int COM_ReadReg32(unsigned long addr)
{
return ioread32((void *)addr);
}
static inline void COM_WriteReg32(
unsigned long addr, unsigned int Val)
{
iowrite32(Val, (void *)addr);
/* make sure memory manipulation sequence is OK */
mb();
}
#endif
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,302 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2020 MediaTek Inc.
*/
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
#include <linux/kobject.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/cdev.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/io.h>
#include "smi_reg.h"
#include "smi_common.h"
#include "smi_priv.h"
static void mt8173_init_setting(struct mtk_smi_data *smidev,
bool *default_saved, u32 *default_smi_val,
unsigned int larbid)
{
/* save default larb regs */
if (!(*default_saved)) {
pr_debug("Save default config:\n");
default_smi_val[0] = M4U_ReadReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB0);
default_smi_val[1] = M4U_ReadReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB1);
default_smi_val[2] = M4U_ReadReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB2);
default_smi_val[3] = M4U_ReadReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB3);
default_smi_val[4] = M4U_ReadReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB4);
default_smi_val[5] = M4U_ReadReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB5);
pr_debug("l1arb[0-2]= 0x%x, 0x%x, 0x%x\n", default_smi_val[0],
default_smi_val[1], default_smi_val[2]);
pr_debug("l1arb[3-4]= 0x%x, 0x%x 0x%x\n", default_smi_val[3],
default_smi_val[4], default_smi_val[5]);
*default_saved = true;
}
/* Keep the HW's init setting in REG_SMI_L1ARB0 ~ REG_SMI_L1ARB4 */
M4U_WriteReg32(SMI_COMMON_EXT_BASE, REG_OFFSET_SMI_L1ARB0,
default_smi_val[0]);
M4U_WriteReg32(SMI_COMMON_EXT_BASE, REG_OFFSET_SMI_L1ARB1,
default_smi_val[1]);
M4U_WriteReg32(SMI_COMMON_EXT_BASE, REG_OFFSET_SMI_L1ARB2,
default_smi_val[2]);
M4U_WriteReg32(SMI_COMMON_EXT_BASE, REG_OFFSET_SMI_L1ARB3,
default_smi_val[3]);
M4U_WriteReg32(SMI_COMMON_EXT_BASE, REG_OFFSET_SMI_L1ARB4,
default_smi_val[4]);
M4U_WriteReg32(SMI_COMMON_EXT_BASE, REG_OFFSET_SMI_L1ARB5,
default_smi_val[5]);
M4U_WriteReg32(SMI_COMMON_EXT_BASE, 0x200, 0x1b);
/* disp(larb0+larb4): emi0, other:emi1 */
M4U_WriteReg32(SMI_COMMON_EXT_BASE, 0x220, (0x1<<0) | (0x1<<8));
M4U_WriteReg32(SMI_COMMON_EXT_BASE, 0x234,
(0x1 << 31) + (0x13 << 26) + (0x14 << 21) +
(0x0 << 20) + (0x2 << 15) +
(0x3 << 10) + (0x4 << 5) + 0x5);
M4U_WriteReg32(SMI_COMMON_EXT_BASE, 0x238,
(0x2 << 25) + (0x3 << 20) + (0x4 << 15) +
(0x5 << 10) + (0x6 << 5) + 0x8);
M4U_WriteReg32(SMI_COMMON_EXT_BASE, 0x230,
0x1f + (0x8 << 5) + (0x6 << 10));
/* Set VC priority: MMSYS = ISP > VENC > VDEC = MJC */
M4U_WriteReg32(LARB0_BASE, 0x20, 0x0); /* MMSYS */
M4U_WriteReg32(LARB1_BASE, 0x20, 0x2); /* VDEC */
M4U_WriteReg32(LARB2_BASE, 0x20, 0x0); /* ISP */
M4U_WriteReg32(LARB3_BASE, 0x20, 0x1); /* VENC */
M4U_WriteReg32(LARB4_BASE, 0x20, 0x0); /* DISP1 */
M4U_WriteReg32(LARB5_BASE, 0x20, 0x1); /* VENC2 */
/* turn off EMI empty double OSTD */
M4U_WriteReg32(LARB0_BASE, 0x2c,
M4U_ReadReg32(LARB0_BASE, 0x2c) | (1 << 2));
M4U_WriteReg32(LARB1_BASE, 0x2c,
M4U_ReadReg32(LARB1_BASE, 0x2c) | (1 << 2));
M4U_WriteReg32(LARB2_BASE, 0x2c,
M4U_ReadReg32(LARB2_BASE, 0x2c) | (1 << 2));
M4U_WriteReg32(LARB3_BASE, 0x2c,
M4U_ReadReg32(LARB3_BASE, 0x2c) | (1 << 2));
M4U_WriteReg32(LARB4_BASE, 0x2c,
M4U_ReadReg32(LARB4_BASE, 0x2c) | (1 << 2));
M4U_WriteReg32(LARB5_BASE, 0x2c,
M4U_ReadReg32(LARB5_BASE, 0x2c) | (1 << 2));
/*
* confirm. sometimes the reg can not be wrote
* while its clock is disable
*/
if ((M4U_ReadReg32(LARB1_BASE, 0x20) != 0x2) ||
(M4U_ReadReg32(LARB0_BASE, 0x20) != 0x0)) {
pr_warn("warning setting failed. please check clk. 0x%x-0x%x\n",
M4U_ReadReg32(LARB1_BASE, 0x20),
M4U_ReadReg32(LARB0_BASE, 0x20));
}
}
static void mt8173_vp_setting(struct mtk_smi_data *smidev)
{
/* VP 4K */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB0, 0x17C0); /* LARB0, DISP+MDP */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB1, 0x161B); /* LARB1, VDEC */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB2, 0x1000); /* LARB2, ISP */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB3, 0x1000); /* LARB3, VENC+JPG */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB4, 0x17C0); /* LARB4, DISP2+MDP2 */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB5, 0x1000); /* LARB5, VENC2 */
M4U_WriteReg32(LARB0_BASE, 0x200, 0x18);/* ovl_ch0_0/1 */
M4U_WriteReg32(LARB0_BASE, 0x214, 0x4); /* mdp_rdma0; min(4,5) */
M4U_WriteReg32(LARB0_BASE, 0x21c, 0x5); /* mdp_wrot0 */
M4U_WriteReg32(LARB4_BASE, 0x200, 0x8); /* ovl_ch1_0/1 */
M4U_WriteReg32(LARB4_BASE, 0x210, 0x4); /* mdp_rdma1; min(4,5) */
M4U_WriteReg32(LARB4_BASE, 0x214, 0x3); /* mdp_wrot1 */
M4U_WriteReg32(LARB1_BASE, 0x200, 0x1f); /* port#0, mc */
M4U_WriteReg32(LARB1_BASE, 0x204, 0x06);/* port#1, pp */
M4U_WriteReg32(LARB1_BASE, 0x208, 0x1); /* port#2, ufo */
M4U_WriteReg32(LARB1_BASE, 0x20c, 0x1); /* port#3, vld */
M4U_WriteReg32(LARB1_BASE, 0x210, 0x1); /* port#4, vld2 */
M4U_WriteReg32(LARB1_BASE, 0x214, 0x2); /* port#5, mv */
M4U_WriteReg32(LARB1_BASE, 0x218, 0x1); /* port#6, pred rd */
M4U_WriteReg32(LARB1_BASE, 0x21c, 0x1); /* port#7, pred wr */
M4U_WriteReg32(LARB1_BASE, 0x220, 0x1); /* port#8, ppwrap */
}
static void mt8173_vr_setting(struct mtk_smi_data *smidev)
{
/* VR 4K */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB0, 0x1614); /* LARB0, DISP+MDP */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB1, 0x1000); /* LARB1, VDEC */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB2, 0x11F7); /* LARB2, ISP */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB3, 0x1584); /* LARB3, VENC+JPG */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB4, 0x1614); /* LARB4, DISP2+MDP2 */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB5, 0x1584); /* LARB5, VENC2 */
M4U_WriteReg32(LARB0_BASE, 0x200, 0x1f);
/* ovl_ch0_0+ovl_ch0_1 */
M4U_WriteReg32(LARB0_BASE, 0x218, 0x2); /* mdp_wdma */
M4U_WriteReg32(LARB0_BASE, 0x21C, 0x5); /* mdp_wrot0; min(9,5) */
M4U_WriteReg32(LARB2_BASE, 0x200, 0x8); /* imgo */
M4U_WriteReg32(LARB2_BASE, 0x208, 0x1); /* aao */
M4U_WriteReg32(LARB2_BASE, 0x20c, 0x1); /* lsco */
M4U_WriteReg32(LARB2_BASE, 0x210, 0x1); /* esfko */
M4U_WriteReg32(LARB2_BASE, 0x218, 0x1); /* lsci */
M4U_WriteReg32(LARB2_BASE, 0x220, 0x1); /* bpci */
M4U_WriteReg32(LARB2_BASE, 0x22c, 0x4); /* imgi */
M4U_WriteReg32(LARB2_BASE, 0x230, 0x1); /* img2o */
M4U_WriteReg32(LARB2_BASE, 0x244, 0x1); /* lcei */
M4U_WriteReg32(LARB3_BASE, 0x200, 0x1); /* venc_rcpu */
M4U_WriteReg32(LARB3_BASE, 0x204, 0x4); /* venc_rec_frm */
M4U_WriteReg32(LARB3_BASE, 0x208, 0x1); /* venc_bsdma */
M4U_WriteReg32(LARB3_BASE, 0x20c, 0x1); /* venc_sv_comv */
M4U_WriteReg32(LARB3_BASE, 0x210, 0x1); /* venc_rd_comv */
M4U_WriteReg32(LARB3_BASE, 0x224, 0x8); /* venc_cur_luma */
M4U_WriteReg32(LARB3_BASE, 0x228, 0x4); /* venc_cur_chroma */
M4U_WriteReg32(LARB3_BASE, 0x230, 0x10);/* venc_ref_chroma */
M4U_WriteReg32(LARB4_BASE, 0x200, 0x1f);
/* ovl_ch1_0+ovl_ch1_1 */
M4U_WriteReg32(LARB4_BASE, 0x218, 0x2); /* mdp_wdma */
M4U_WriteReg32(LARB4_BASE, 0x21C, 0x5); /* mdp_wrot0; min(9,5) */
/* VDEC */
M4U_WriteReg32(LARB1_BASE, 0x200, 0x1f); /* port#0, mc */
M4U_WriteReg32(LARB1_BASE, 0x204, 0x06);/* port#1, pp */
M4U_WriteReg32(LARB1_BASE, 0x208, 0x1); /* port#2, ufo */
M4U_WriteReg32(LARB1_BASE, 0x20c, 0x1); /* port#3, vld */
M4U_WriteReg32(LARB1_BASE, 0x210, 0x1); /* port#4, vld2 */
M4U_WriteReg32(LARB1_BASE, 0x214, 0x2); /* port#5, avc mv */
M4U_WriteReg32(LARB1_BASE, 0x218, 0x1); /* port#6, pred rd */
M4U_WriteReg32(LARB1_BASE, 0x21c, 0x1); /* port#7, pred wr */
M4U_WriteReg32(LARB1_BASE, 0x220, 0x1); /* port#8, ppwrap */
/*venc2 */
M4U_WriteReg32(LARB5_BASE, 0x200, 0x1); /* venc_rcpu2 */
M4U_WriteReg32(LARB5_BASE, 0x204, 0x4); /* venc_rec_frm2 */
/* venc_ref_luma2 */
M4U_WriteReg32(LARB5_BASE, 0x20c, 0x10); /* venc_ref_chroma2 */
M4U_WriteReg32(LARB5_BASE, 0x210, 0x1); /* venc_bsdma2 */
M4U_WriteReg32(LARB5_BASE, 0x214, 0x8); /* venc_cur_luma2 */
M4U_WriteReg32(LARB5_BASE, 0x218, 0x4); /* venc_cur_chroma2 */
M4U_WriteReg32(LARB5_BASE, 0x21c, 0x1); /* venc_rd_comv2 */
M4U_WriteReg32(LARB5_BASE, 0x220, 0x1); /* venc_sv_comv2 */
}
static void mt8173_hdmi_setting(struct mtk_smi_data *smidev)
{
/* VP 4K */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB0, 0x1117); /* LARB0, DISP+MDP */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB1, 0x1659); /* LARB1, VDEC */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB2, 0x1000); /* LARB2, ISP */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB3, 0x1000); /* LARB3, VENC+JPG */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB4, 0x1750); /* LARB4, DISP2+MDP2 */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB5, 0x1000); /* LARB5, VENC2 */
M4U_WriteReg32(LARB0_BASE, 0x200, 0x18);/* ovl_ch0_0/1 */
M4U_WriteReg32(LARB0_BASE, 0x214, 0x4); /* mdp_rdma0; min(4,5) */
M4U_WriteReg32(LARB0_BASE, 0x21c, 0x5); /* mdp_wrot0 */
M4U_WriteReg32(LARB4_BASE, 0x200, 0x8); /* ovl_ch1_0/1 */
M4U_WriteReg32(LARB4_BASE, 0x210, 0x4); /* mdp_rdma1; min(4,5) */
M4U_WriteReg32(LARB4_BASE, 0x214, 0x3); /* mdp_wrot1 */
M4U_WriteReg32(LARB1_BASE, 0x200, 0x1f); /* port#0, mc */
M4U_WriteReg32(LARB1_BASE, 0x204, 0x06);/* port#1, pp */
M4U_WriteReg32(LARB1_BASE, 0x208, 0x1); /* port#2, ufo */
M4U_WriteReg32(LARB1_BASE, 0x20c, 0x1); /* port#3, vld */
M4U_WriteReg32(LARB1_BASE, 0x210, 0x1); /* port#4, vld2 */
M4U_WriteReg32(LARB1_BASE, 0x214, 0x2); /* port#5, mv */
M4U_WriteReg32(LARB1_BASE, 0x218, 0x1); /* port#6, pred rd */
M4U_WriteReg32(LARB1_BASE, 0x21c, 0x1); /* port#7, pred wr */
M4U_WriteReg32(LARB1_BASE, 0x220, 0x1); /* port#8, ppwrap */
}
static void mt8173_hdmi4k_setting(struct mtk_smi_data *smidev)
{
/* VP 4K */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB0, 0x12A6); /* LARB0, DISP+MDP */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB1, 0x158B); /* LARB1, VDEC */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB2, 0x1000); /* LARB2, ISP */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB3, 0x1000); /* LARB3, VENC+JPG */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB4, 0x1A6D); /* LARB4, DISP2+MDP2 */
M4U_WriteReg32(SMI_COMMON_EXT_BASE,
REG_OFFSET_SMI_L1ARB5, 0x1000); /* LARB5, VENC2 */
M4U_WriteReg32(LARB0_BASE, 0x200, 0x18);/* ovl_ch0_0/1 */
M4U_WriteReg32(LARB0_BASE, 0x214, 0x4); /* mdp_rdma0; min(4,5) */
M4U_WriteReg32(LARB0_BASE, 0x21c, 0x5); /* mdp_wrot0 */
M4U_WriteReg32(LARB4_BASE, 0x200, 0x8); /* ovl_ch1_0/1 */
M4U_WriteReg32(LARB4_BASE, 0x210, 0x4); /* mdp_rdma1; min(4,5) */
M4U_WriteReg32(LARB4_BASE, 0x214, 0x3); /* mdp_wrot1 */
M4U_WriteReg32(LARB1_BASE, 0x200, 0x1f); /* port#0, mc */
M4U_WriteReg32(LARB1_BASE, 0x204, 0x06);/* port#1, pp */
M4U_WriteReg32(LARB1_BASE, 0x208, 0x1); /* port#2, ufo */
M4U_WriteReg32(LARB1_BASE, 0x20c, 0x1); /* port#3, vld */
M4U_WriteReg32(LARB1_BASE, 0x210, 0x1); /* port#4, vld2 */
M4U_WriteReg32(LARB1_BASE, 0x214, 0x2); /* port#5, mv */
M4U_WriteReg32(LARB1_BASE, 0x218, 0x1); /* port#6, pred rd */
M4U_WriteReg32(LARB1_BASE, 0x21c, 0x1); /* port#7, pred wr */
M4U_WriteReg32(LARB1_BASE, 0x220, 0x1); /* port#8, ppwrap */
}
/* Make sure all the clock is enabled */
const struct mtk_smi_priv smi_mt8173_priv = {
.plat = MTK_PLAT_MT8173,
.larb_port_num = {8, 9, 21, 15, 6, 9},
.larb_vc_setting = { 0, 2, 0, 1, 0, 1 },
.init_setting = mt8173_init_setting,
.vp_setting = mt8173_vp_setting,
.vr_setting = mt8173_vr_setting,
.hdmi_setting = mt8173_hdmi_setting,
.hdmi_4k_setting = mt8173_hdmi4k_setting,
};