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

+8
View File
@@ -0,0 +1,8 @@
config MTK_EMI_BWL
bool "enable MTK_EMI_BWL"
default n
help
This config enable/disable EMI Bandwidth Limit driver.
EMI Bandwidth Limit driver is used to set different
bandwidth limit value for different scenario.
It can set individual value for all EMI master ports.
+16
View File
@@ -0,0 +1,16 @@
#
# 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.
#
ifeq ($(CONFIG_MACH_MT6739), y)
obj-y += $(subst ",,$(CONFIG_MTK_PLATFORM))/
endif
@@ -0,0 +1,20 @@
#
# 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/dramc/$(MTK_PLATFORM)
ccflags-y += -I$(srctree)/drivers/watchdog/mediatek/include
obj-y += emi_bwl.o
obj-y += emi_mbw.o
obj-y += emi_mbw_api.o
obj-y += emi_elm.o
@@ -0,0 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
/* format: X_CON_SCE(name, ARBA~ARBH, CONM, MDCT) */
/* SW_PDE */
X_CON_SCE(CON_SCE_SW_PDE, 0x4f00724a, 0x6030505c, 0xffff7041, 0x40207056,
0x80806047, 0xffff7041, 0x0, 0x0, 0x008806b0, 0x11118c37)
/* UI: UI with N layer */
X_CON_SCE(CON_SCE_UI, 0x4f00724a, 0x607f5050, 0xffff7041, 0x050f7057,
0xa0806048, 0xffff7046, 0x0, 0x0, 0x000006b0, 0x34118c37)
@@ -0,0 +1,525 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/semaphore.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/printk.h>
#include <linux/spinlock.h>
#include <linux/delay.h>
#define MET_USER_EVENT_SUPPORT
/* #include <linux/met_drv.h> */
#include <mt-plat/mtk_io.h>
#include <mt-plat/sync_write.h>
/* #include <ext_wd_drv.h> */
#include "emi_bwl.h"
#include "emi_mbw.h"
#include "emi_elm.h"
#define DRIVER_ATTR(_name, _mode, _show, _store) \
struct driver_attribute driver_attr_##_name = \
__ATTR(_name, _mode, _show, _store)
DEFINE_SEMAPHORE(emi_bwl_sem);
static void __iomem *CEN_EMI_BASE;
static void __iomem *CHA_EMI_BASE;
static void __iomem *EMI_MPU_BASE;
static unsigned int mpu_irq;
static unsigned int cgm_irq;
static unsigned int elm_irq;
static struct emi_info_t emi_info;
static int emi_probe(struct platform_device *pdev)
{
struct resource *res;
struct device_node *node = pdev->dev.of_node;
int ret;
pr_debug("[EMI] module probe.\n");
if (node) {
mpu_irq = irq_of_parse_and_map(node, 0);
cgm_irq = irq_of_parse_and_map(node, 1);
elm_irq = irq_of_parse_and_map(node, 2);
pr_info("[EMI] get irq of MPU(%d), GCM(%d), ELM(%d)\n",
mpu_irq, cgm_irq, elm_irq);
} else {
mpu_irq = 0;
cgm_irq = 0;
elm_irq = 0;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
CEN_EMI_BASE = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(CEN_EMI_BASE)) {
pr_info("[EMI] unable to map CEN_EMI_BASE\n");
return -EINVAL;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
CHA_EMI_BASE = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(CHA_EMI_BASE)) {
pr_info("[EMI] unable to map CHA_EMI_BASE\n");
return -EINVAL;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
EMI_MPU_BASE = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(EMI_MPU_BASE)) {
pr_info("[EMI] unable to map EMI_MPU_BASE\n");
return -EINVAL;
}
pr_info("[EMI] get CEN_EMI_BASE @ %p\n", mt_cen_emi_base_get());
pr_info("[EMI] get CHA_EMI_BASE @ %p\n", mt_chn_emi_base_get());
pr_info("[EMI] get EMI_MPU_BASE @ %p\n", mt_emi_mpu_base_get());
ret = mtk_mem_bw_ctrl(CON_SCE_UI, ENABLE_CON_SCE);
if (ret)
pr_info("[EMI/BWL] fail to set EMI bandwidth limiter\n");
writel(0x00000040, CHA_EMI_BASE+0x0008);
mt_reg_sync_writel(0x00000913, CEN_EMI_BASE+0x5B0);
#if ENABLE_MBW
mbw_init();
#endif
#if ENABLE_ELM
elm_init(cgm_irq);
#endif
return 0;
}
static int emi_remove(struct platform_device *dev)
{
return 0;
}
#ifdef CONFIG_OF
static const struct of_device_id emi_of_ids[] = {
{.compatible = "mediatek,emi",},
{}
};
#endif
#ifdef CONFIG_PM
static int emi_suspend_noirq(struct device *dev)
{
/* pr_info("[EMI] suspend\n"); */
suspend_elm();
return 0;
}
static int emi_resume_noirq(struct device *dev)
{
/* pr_info("[EMI] resume\n"); */
resume_elm();
return 0;
}
static const struct dev_pm_ops emi_pm_ops = {
.suspend_noirq = emi_suspend_noirq,
.resume_noirq = emi_resume_noirq,
};
#define EMI_PM_OPS (&emi_pm_ops)
#else
#define EMI_PM_OPS NULL
#endif
static struct platform_driver emi_ctrl = {
.probe = emi_probe,
.remove = emi_remove,
.driver = {
.name = "emi_ctrl",
.owner = THIS_MODULE,
.pm = EMI_PM_OPS,
#ifdef CONFIG_OF
.of_match_table = emi_of_ids,
#endif
},
};
/* define EMI bandwiwth limiter control table */
static struct emi_bwl_ctrl ctrl_tbl[NR_CON_SCE];
/* current concurrency scenario */
static int cur_con_sce = 0x0FFFFFFF;
/* define concurrency scenario strings */
static const char * const con_sce_str[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) (#con_sce),
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
/****************** For LPDDR4-3200******************/
static const unsigned int emi_arba_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) arba,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbb_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) arbb,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbc_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) arbc,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbd_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) arbd,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbe_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) arbe,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbf_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) arbf,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbg_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) arbg,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
static const unsigned int emi_arbh_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) arbh,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
static const unsigned int emi_conm_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) conm,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
static const unsigned int emi_mdct_lpddr4_val[] = {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) mdct,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
};
/*
* mtk_mem_bw_ctrl: set EMI bandwidth limiter for memory bandwidth control
* @sce: concurrency scenario ID
* @op: either ENABLE_CON_SCE or DISABLE_CON_SCE
* Return 0 for success; return negative values for failure.
*/
int mtk_mem_bw_ctrl(int sce, int op)
{
int i, highest;
if (sce >= NR_CON_SCE)
return -1;
if (op != ENABLE_CON_SCE && op != DISABLE_CON_SCE)
return -1;
if (in_interrupt())
return -1;
down(&emi_bwl_sem);
if (op == ENABLE_CON_SCE)
ctrl_tbl[sce].ref_cnt++;
else if (op == DISABLE_CON_SCE) {
if (ctrl_tbl[sce].ref_cnt != 0)
ctrl_tbl[sce].ref_cnt--;
}
/* find the scenario with the highest priority */
highest = -1;
for (i = 0; i < NR_CON_SCE; i++) {
if (ctrl_tbl[i].ref_cnt != 0) {
highest = i;
break;
}
}
if (highest == -1)
highest = CON_SCE_UI;
/* set new EMI bandwidth limiter value */
if (highest != cur_con_sce) {
writel(emi_arba_lpddr4_val[highest], EMI_ARBA);
writel(emi_arbb_lpddr4_val[highest], EMI_ARBB);
writel(emi_arbc_lpddr4_val[highest], EMI_ARBC);
writel(emi_arbd_lpddr4_val[highest], EMI_ARBD);
writel(emi_arbe_lpddr4_val[highest], EMI_ARBE);
writel(emi_arbf_lpddr4_val[highest], EMI_ARBF);
writel(emi_arbg_lpddr4_val[highest], EMI_ARBG);
writel(emi_arbh_lpddr4_val[highest], EMI_ARBH);
writel(emi_conm_lpddr4_val[highest], EMI_CONM);
mt_reg_sync_writel(emi_mdct_lpddr4_val[highest], EMI_MDCT);
cur_con_sce = highest;
}
up(&emi_bwl_sem);
return 0;
}
/*
* con_sce_show: sysfs con_sce file show function.
* @driver:
* @buf:
* Return the number of read bytes.
*/
static ssize_t con_sce_show(struct device_driver *driver, char *buf)
{
char *ptr = buf;
int i = 0;
if (cur_con_sce >= NR_CON_SCE) {
ptr += sprintf(ptr, "none\n");
return strlen(buf);
}
ptr += snprintf(ptr, 64, "current scenario: %s\n", con_sce_str[cur_con_sce]);
#if 1
ptr += snprintf(ptr, 32, "%s\n", con_sce_str[cur_con_sce]);
ptr += sprintf(ptr, "EMI_ARBA = 0x%x\n", readl(IOMEM(EMI_ARBA)));
ptr += sprintf(ptr, "EMI_ARBB = 0x%x\n", readl(IOMEM(EMI_ARBB)));
ptr += sprintf(ptr, "EMI_ARBC = 0x%x\n", readl(IOMEM(EMI_ARBC)));
ptr += sprintf(ptr, "EMI_ARBD = 0x%x\n", readl(IOMEM(EMI_ARBD)));
ptr += sprintf(ptr, "EMI_ARBE = 0x%x\n", readl(IOMEM(EMI_ARBE)));
ptr += sprintf(ptr, "EMI_ARBF = 0x%x\n", readl(IOMEM(EMI_ARBF)));
ptr += sprintf(ptr, "EMI_ARBG = 0x%x\n", readl(IOMEM(EMI_ARBG)));
ptr += sprintf(ptr, "EMI_ARBH = 0x%x\n", readl(IOMEM(EMI_ARBH)));
ptr += sprintf(ptr, "EMI_CONM = 0x%x\n", readl(IOMEM(EMI_CONM)));
ptr += sprintf(ptr, "EMI_MDCT = 0x%x\n", readl(IOMEM(EMI_MDCT)));
for (i = 0; i < NR_CON_SCE; i++)
ptr += snprintf(ptr, 64, "%s = 0x%x\n",
con_sce_str[i], ctrl_tbl[i].ref_cnt);
pr_debug("[EMI BWL] EMI_ARBA = 0x%x\n", readl(IOMEM(EMI_ARBA)));
pr_debug("[EMI BWL] EMI_ARBB = 0x%x\n", readl(IOMEM(EMI_ARBB)));
pr_debug("[EMI BWL] EMI_ARBC = 0x%x\n", readl(IOMEM(EMI_ARBC)));
pr_debug("[EMI BWL] EMI_ARBD = 0x%x\n", readl(IOMEM(EMI_ARBD)));
pr_debug("[EMI BWL] EMI_ARBE = 0x%x\n", readl(IOMEM(EMI_ARBE)));
pr_debug("[EMI BWL] EMI_ARBF = 0x%x\n", readl(IOMEM(EMI_ARBF)));
pr_debug("[EMI BWL] EMI_ARBG = 0x%x\n", readl(IOMEM(EMI_ARBG)));
pr_debug("[EMI BWL] EMI_ARBH = 0x%x\n", readl(IOMEM(EMI_ARBH)));
pr_debug("[EMI BWL] EMI_CONM = 0x%x\n", readl(IOMEM(EMI_CONM)));
pr_debug("[EMI BWL] EMI_MDCT = 0x%x\n", readl(IOMEM(EMI_MDCT)));
#endif
return strlen(buf);
}
/*
* con_sce_store: sysfs con_sce file store function.
* @driver:
* @buf:
* @count:
* Return the number of write bytes.
*/
static ssize_t con_sce_store(struct device_driver *driver,
const char *buf, size_t count)
{
int i;
for (i = 0; i < NR_CON_SCE; i++) {
if (!strncmp(buf, con_sce_str[i], strlen(con_sce_str[i]))) {
if (!strncmp(buf + strlen(con_sce_str[i]) + 1,
EN_CON_SCE_STR, strlen(EN_CON_SCE_STR))) {
mtk_mem_bw_ctrl(i, ENABLE_CON_SCE);
/* pr_debug("concurrency scenario %s ON\n", con_sce_str[i]); */
break;
} else if (!strncmp(buf + strlen(con_sce_str[i]) + 1,
DIS_CON_SCE_STR, strlen(DIS_CON_SCE_STR))) {
mtk_mem_bw_ctrl(i, DISABLE_CON_SCE);
/* pr_debug("concurrency scenario %s OFF\n", con_sce_str[i]); */
break;
}
}
}
return count;
}
DRIVER_ATTR(concurrency_scenario, 0644, con_sce_show, con_sce_store);
static ssize_t elm_ctrl_show(struct device_driver *driver, char *buf)
{
char *ptr;
ptr = (char *)buf;
ptr += sprintf(ptr, "ELM enabled: %d\n", is_elm_enabled());
return strlen(buf);
}
static ssize_t elm_ctrl_store(struct device_driver *driver,
const char *buf, size_t count)
{
if (!strncmp(buf, "ON", strlen("ON")))
enable_elm();
else if (!strncmp(buf, "OFF", strlen("OFF")))
disable_elm();
return count;
}
DRIVER_ATTR(elm_ctrl, 0644, elm_ctrl_show, elm_ctrl_store);
/*
* emi_ctrl_init: module init function.
*/
static int __init emi_ctrl_init(void)
{
int ret;
int i;
/* register EMI ctrl interface */
ret = platform_driver_register(&emi_ctrl);
if (ret)
pr_info("[EMI/BWL] fail to register emi_ctrl driver\n");
ret = driver_create_file(&emi_ctrl.driver, &driver_attr_concurrency_scenario);
if (ret)
pr_info("[EMI/BWL] fail to create emi_bwl sysfs file\n");
ret = driver_create_file(&emi_ctrl.driver, &driver_attr_elm_ctrl);
if (ret)
pr_info("[EMI/ELM] fail to create elm_ctrl file\n");
/* get EMI info from boot tags */
if (of_chosen) {
ret = of_property_read_u32(of_chosen, "emi_info,dram_type", &(emi_info.dram_type));
if (ret)
pr_info("[EMI] fail to get dram_type\n");
ret = of_property_read_u32(of_chosen, "emi_info,ch_num", &(emi_info.ch_num));
if (ret)
pr_info("[EMI] fail to get ch_num\n");
ret = of_property_read_u32(of_chosen, "emi_info,rk_num", &(emi_info.rk_num));
if (ret)
pr_info("[EMI] fail to get rk_num\n");
ret = of_property_read_u32_array(of_chosen, "emi_info,rank_size",
emi_info.rank_size, MAX_RK);
if (ret)
pr_info("[EMI] fail to get rank_size\n");
}
pr_info("[EMI] dram_type(%d)\n", get_dram_type());
pr_info("[EMI] ch_num(%d)\n", get_ch_num());
pr_info("[EMI] rk_num(%d)\n", get_rk_num());
for (i = 0; i < get_rk_num(); i++)
pr_info("[EMI] rank%d_size(0x%x)", i, get_rank_size(i));
return 0;
}
/*
* emi_ctrl_exit: module exit function.
*/
static void __exit emi_ctrl_exit(void)
{
}
postcore_initcall(emi_ctrl_init);
module_exit(emi_ctrl_exit);
unsigned int get_ch_num(void)
{
return emi_info.ch_num;
}
unsigned int get_rk_num(void)
{
if (emi_info.rk_num > MAX_RK)
pr_info("[EMI] rank overflow\n");
return emi_info.rk_num;
}
unsigned int get_rank_size(unsigned int rank_index)
{
if (rank_index < emi_info.rk_num)
return emi_info.rank_size[rank_index];
return 0;
}
unsigned int get_dram_type(void)
{
return emi_info.dram_type;
}
EXPORT_SYMBOL(get_dram_type);
void __iomem *mt_cen_emi_base_get(void)
{
return CEN_EMI_BASE;
}
EXPORT_SYMBOL(mt_cen_emi_base_get);
void __iomem *mt_emi_base_get(void)
{
return mt_cen_emi_base_get();
}
EXPORT_SYMBOL(mt_emi_base_get);
void __iomem *mt_chn_emi_base_get()
{
return CHA_EMI_BASE;
}
EXPORT_SYMBOL(mt_chn_emi_base_get);
void __iomem *mt_emi_mpu_base_get(void)
{
return EMI_MPU_BASE;
}
EXPORT_SYMBOL(mt_emi_mpu_base_get);
unsigned int mt_emi_mpu_irq_get(void)
{
return mpu_irq;
}
unsigned int mt_emi_elm_irq_get(void)
{
return elm_irq;
}
unsigned int mt_emi_cgm_irq_get(void)
{
return cgm_irq;
}
@@ -0,0 +1,80 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __MT_EMI_BW_LIMITER__
#define __MT_EMI_BW_LIMITER__
/*
* Define EMI hardware registers.
*/
#define EMI_CONM (CEN_EMI_BASE + 0x0060)
#define EMI_MDCT (CEN_EMI_BASE + 0x0078)
#define EMI_ARBA (CEN_EMI_BASE + 0x0100)
#define EMI_ARBB (CEN_EMI_BASE + 0x0108)
#define EMI_ARBC (CEN_EMI_BASE + 0x0110)
#define EMI_ARBD (CEN_EMI_BASE + 0x0118)
#define EMI_ARBE (CEN_EMI_BASE + 0x0120)
#define EMI_ARBF (CEN_EMI_BASE + 0x0128)
#define EMI_ARBG (CEN_EMI_BASE + 0x0130)
#define EMI_ARBH (CEN_EMI_BASE + 0x0138)
/*
* Define constants.
*/
#define MAX_CH 2
#define MAX_RK 2
/* define concurrency scenario ID */
enum {
#define X_CON_SCE(con_sce, arba, arbb, arbc, arbd, arbe, arbf, arbg, arbh, \
conm, mdct) con_sce,
#include "con_sce_lpddr3.h"
#undef X_CON_SCE
NR_CON_SCE
};
/* define control operation */
enum {
ENABLE_CON_SCE = 0,
DISABLE_CON_SCE = 1
};
#define EN_CON_SCE_STR "ON"
#define DIS_CON_SCE_STR "OFF"
/*
* Define data structures.
*/
/* define control table entry */
struct emi_bwl_ctrl {
unsigned int ref_cnt;
};
struct emi_info_t {
unsigned int dram_type;
unsigned int ch_num;
unsigned int rk_num;
unsigned int rank_size[MAX_RK];
};
/*
* Define function prototype.
*/
extern int mtk_mem_bw_ctrl(int sce, int op);
extern unsigned int get_ch_num(void);
extern unsigned int get_rk_num(void);
extern unsigned int get_rank_size(unsigned int rank_index); /* unit: all channels */
extern unsigned int get_dram_type(void);
extern void __iomem *mt_emi_base_get(void); /* legacy API */
extern void __iomem *mt_cen_emi_base_get(void);
extern void __iomem *mt_chn_emi_base_get(void);
extern void __iomem *mt_emi_mpu_base_get(void);
extern unsigned int mt_emi_mpu_irq_get(void);
#endif /* !__MT_EMI_BWL_H__ */
@@ -0,0 +1,366 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/spinlock.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/of_irq.h>
#include <mt-plat/sync_write.h>
#include <mt-plat/mtk_io.h>
#ifdef CONFIG_MTK_AEE_FEATURE
#include <mt-plat/aee.h>
#endif
#include "emi_elm.h"
#include "emi_bwl.h"
#include "emi_mbw.h"
#include <mtk_dramc.h>
static void __iomem *CEN_EMI_BASE; /* not initialise statics to 0 or NULL */
static bool elm_enabled;
static DEFINE_SPINLOCK(elm_lock);
static unsigned int elm_valid;
static unsigned int dram_data_rate;
static unsigned int emi_cgma_st0;
static unsigned int emi_cgma_st1;
static unsigned int emi_cgma_st2;
static unsigned int emi_ebmint_st;
static unsigned int emi_ltct0;
static unsigned int emi_ltct1;
static unsigned int emi_ltct2;
static unsigned int emi_ltct3;
static unsigned int emi_ltst0;
static unsigned int emi_ltst1;
static unsigned int emi_ltst2;
static unsigned int emi_bmen;
static unsigned int emi_bmen2;
static unsigned int emi_msel;
static unsigned int emi_msel2;
static unsigned int emi_bmrw0;
static unsigned int emi_bcnt;
static unsigned int emi_wsct;
static unsigned int emi_wsct2;
static unsigned int emi_wsct3;
static unsigned int emi_wsct4;
static unsigned int emi_ttype[16];
bool is_elm_enabled(void)
{
return elm_enabled;
}
EXPORT_SYMBOL(is_elm_enabled);
void enable_elm(void)
{
unsigned long flags;
int emi_dcm_status;
spin_lock_irqsave(&elm_lock, flags);
emi_dcm_status = BM_GetEmiDcm();
BM_SetEmiDcm(0x40);
/* Setup and enable BM */
mt_reg_sync_writel(readl(IOMEM(EMI_BMEN)) & 0xfffffffc, EMI_BMEN);
writel(0x00ff0000, IOMEM(EMI_BMEN));
writel(0x00020001, IOMEM(EMI_MSEL));
writel(0x00000018, IOMEM(EMI_MSEL2));
writel(0x02000000, IOMEM(EMI_BMEN2));
writel(0xffffffff, IOMEM(EMI_BMRW0));
mt_reg_sync_writel(readl(IOMEM(EMI_BMEN)) | 0x1, EMI_BMEN);
/* Setup and enable CGM */
writel(0x0ffffff0, IOMEM(EMI_CGMA));
/* Enable ELM */
writel(readl(IOMEM(EMI_LTCT0_2ND)) | 0x8, IOMEM(EMI_LTCT0_2ND));
mt_reg_sync_writel(readl(IOMEM(EMI_LTCT0_2ND)) | 0x80000000, EMI_LTCT0_2ND);
mt_reg_sync_writel(readl(IOMEM(EMI_LTCT0_2ND)) | 0x1, EMI_LTCT0_2ND);
elm_enabled = true;
BM_SetEmiDcm(emi_dcm_status);
spin_unlock_irqrestore(&elm_lock, flags);
}
EXPORT_SYMBOL(enable_elm);
void disable_elm(void)
{
unsigned long flags;
int emi_dcm_status;
spin_lock_irqsave(&elm_lock, flags);
emi_dcm_status = BM_GetEmiDcm();
BM_SetEmiDcm(0x40);
/* Clear BM */
mt_reg_sync_writel(readl(IOMEM(EMI_BMEN)) & 0xfffffffc, EMI_BMEN);
/* Disable CGM */
writel(0x0, IOMEM(EMI_CGMA));
/* Disable ELM */
writel(readl(IOMEM(EMI_LTCT0_2ND)) & ~0x1, IOMEM(EMI_LTCT0_2ND));
mt_reg_sync_writel(readl(IOMEM(EMI_LTCT0_2ND)) & ~0x8, EMI_LTCT0_2ND);
elm_enabled = false;
BM_SetEmiDcm(emi_dcm_status);
spin_unlock_irqrestore(&elm_lock, flags);
}
EXPORT_SYMBOL(disable_elm);
static void lt_init(void)
{
/* Ask EMI DE to provide the setting of EMI_LTCT0~3,
* which control the period and the threshold of ELM
*/
writel(0x1000cc08, IOMEM(EMI_LTCT0_2ND));
writel(0x08230823, IOMEM(EMI_LTCT1_2ND));
writel(0x08230682, IOMEM(EMI_LTCT2_2ND));
mt_reg_sync_writel(0x362B3636, EMI_LTCT3_2ND);
enable_elm();
}
static int lt_reg_save(void)
{
unsigned int i;
unsigned long flags;
spin_lock_irqsave(&elm_lock, flags);
dram_data_rate = get_dram_data_rate();
emi_cgma_st0 = readl(IOMEM(EMI_CGMA_ST0));
emi_cgma_st1 = readl(IOMEM(EMI_CGMA_ST1));
emi_cgma_st2 = readl(IOMEM(EMI_CGMA_ST2));
emi_ebmint_st = readl(IOMEM(EMI_EBMINT_ST));
emi_ltct0 = readl(IOMEM(EMI_LTCT0_2ND));
emi_ltct1 = readl(IOMEM(EMI_LTCT1_2ND));
emi_ltct2 = readl(IOMEM(EMI_LTCT2_2ND));
emi_ltct3 = readl(IOMEM(EMI_LTCT3_2ND));
emi_ltst0 = readl(IOMEM(EMI_LTST0_2ND));
emi_ltst1 = readl(IOMEM(EMI_LTST1_2ND));
emi_ltst2 = readl(IOMEM(EMI_LTST2_2ND));
emi_bmen = readl(IOMEM(EMI_BMEN));
emi_bmen2 = readl(IOMEM(EMI_BMEN2));
emi_msel = readl(IOMEM(EMI_MSEL));
emi_msel2 = readl(IOMEM(EMI_MSEL2));
emi_bmrw0 = readl(IOMEM(EMI_BMRW0));
emi_bcnt = readl(IOMEM(EMI_BCNT));
emi_wsct = readl(IOMEM(EMI_WSCT));
emi_wsct2 = readl(IOMEM(EMI_WSCT2));
emi_wsct3 = readl(IOMEM(EMI_WSCT3));
emi_wsct4 = readl(IOMEM(EMI_WSCT4));
for (i = 0; i < 16; i++)
emi_ttype[i] = readl(IOMEM(EMI_TTYPE(i)));
elm_valid = 1;
spin_unlock_irqrestore(&elm_lock, flags);
#if 0
pr_info(
"[EMI ELM] ddr data rate: %d, valid: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n",
dram_data_rate, elm_valid,
"EMI_CGMA_ST0", emi_cgma_st0,
"EMI_CGMA_ST1", emi_cgma_st1,
"EMI_CGMA_ST2", emi_cgma_st2,
"EMI_EBMINT_ST", emi_ebmint_st,
"EMI_LTCT0", emi_ltct0,
"EMI_LTCT1", emi_ltct1,
"EMI_LTCT2", emi_ltct2,
"EMI_LTCT3", emi_ltct3,
"EMI_LTST0", emi_ltst0,
"EMI_LTST1", emi_ltst1,
"EMI_LTST2", emi_ltst2,
"EMI_BMEN", emi_bmen,
"EMI_BMEN2", emi_bmen2,
"EMI_MSEL", emi_msel,
"EMI_MSEL2", emi_msel2,
"EMI_BMRW0", emi_bmrw0,
"EMI_BCNT", emi_bcnt,
"EMI_WSCT", emi_wsct,
"EMI_WSCT2", emi_wsct2,
"EMI_WSCT3", emi_wsct3,
"EMI_WSCT4", emi_wsct4,
"EMI_TTYPE1", emi_ttype[0],
"EMI_TTYPE2", emi_ttype[1],
"EMI_TTYPE3", emi_ttype[2],
"EMI_TTYPE4", emi_ttype[3],
"EMI_TTYPE5", emi_ttype[4],
"EMI_TTYPE6", emi_ttype[5],
"EMI_TTYPE7", emi_ttype[6],
"EMI_TTYPE8", emi_ttype[7],
"EMI_TTYPE9", emi_ttype[8],
"EMI_TTYPE10", emi_ttype[9],
"EMI_TTYPE11", emi_ttype[10],
"EMI_TTYPE12", emi_ttype[11],
"EMI_TTYPE13", emi_ttype[12],
"EMI_TTYPE14", emi_ttype[13],
"EMI_TTYPE15", emi_ttype[14],
"EMI_TTYPE16", emi_ttype[15]
);
#endif
return 0;
}
void elm_dump(char *buf, unsigned int leng)
{
unsigned long flags;
int err;
spin_lock_irqsave(&elm_lock, flags);
err = snprintf(buf, leng,
"[EMI ELM] ddr data rate: %d, valid: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n%s: 0x%08x\n"
"%s: 0x%08x\n",
dram_data_rate, elm_valid,
"EMI_CGMA_ST0", emi_cgma_st0,
"EMI_CGMA_ST1", emi_cgma_st1,
"EMI_CGMA_ST2", emi_cgma_st2,
"EMI_EBMINT_ST", emi_ebmint_st,
"EMI_LTCT0", emi_ltct0,
"EMI_LTCT1", emi_ltct1,
"EMI_LTCT2", emi_ltct2,
"EMI_LTCT3", emi_ltct3,
"EMI_LTST0", emi_ltst0,
"EMI_LTST1", emi_ltst1,
"EMI_LTST2", emi_ltst2,
"EMI_BMEN", emi_bmen,
"EMI_BMEN2", emi_bmen2,
"EMI_MSEL", emi_msel,
"EMI_MSEL2", emi_msel2,
"EMI_BMRW0", emi_bmrw0,
"EMI_BCNT", emi_bcnt,
"EMI_WSCT", emi_wsct,
"EMI_WSCT2", emi_wsct2,
"EMI_WSCT3", emi_wsct3,
"EMI_WSCT4", emi_wsct4,
"EMI_TTYPE1", emi_ttype[0],
"EMI_TTYPE2", emi_ttype[1],
"EMI_TTYPE3", emi_ttype[2],
"EMI_TTYPE4", emi_ttype[3],
"EMI_TTYPE5", emi_ttype[4],
"EMI_TTYPE6", emi_ttype[5],
"EMI_TTYPE7", emi_ttype[6],
"EMI_TTYPE8", emi_ttype[7],
"EMI_TTYPE9", emi_ttype[8],
"EMI_TTYPE10", emi_ttype[9],
"EMI_TTYPE11", emi_ttype[10],
"EMI_TTYPE12", emi_ttype[11],
"EMI_TTYPE13", emi_ttype[12],
"EMI_TTYPE14", emi_ttype[13],
"EMI_TTYPE15", emi_ttype[14],
"EMI_TTYPE16", emi_ttype[15]
);
spin_unlock_irqrestore(&elm_lock, flags);
if (err < 0)
buf = NULL;
}
/* elm_irq handler */
static irqreturn_t elm_isr(int irq, void *dev_id)
{
unsigned long flags;
int emi_dcm_status;
pr_info("[EMI ELM] violation\n");
lt_reg_save();
/* Reset counter */
spin_lock_irqsave(&elm_lock, flags);
emi_dcm_status = BM_GetEmiDcm();
BM_SetEmiDcm(0x40);
mt_reg_sync_writel(readl(IOMEM(EMI_BMEN)) & 0xfffffffc, EMI_BMEN);
mt_reg_sync_writel(readl(IOMEM(EMI_LTCT0_2ND)) | 0x80000000, EMI_LTCT0_2ND);
mt_reg_sync_writel(readl(IOMEM(EMI_BMEN)) | 0x1, EMI_BMEN);
BM_SetEmiDcm(emi_dcm_status);
spin_unlock_irqrestore(&elm_lock, flags);
return IRQ_HANDLED;
}
static struct platform_driver elm_ctrl = {
.driver = {
.name = "elm_ctrl",
.bus = &platform_bus_type,
.owner = THIS_MODULE,
},
.id_table = NULL,
};
int elm_init(unsigned int elm_irq)
{
int ret = 0;
CEN_EMI_BASE = mt_cen_emi_base_get();
if (elm_irq != 0) {
ret = request_irq(elm_irq, (irq_handler_t)elm_isr, IRQF_TRIGGER_NONE, "elm", &elm_ctrl);
if (ret != 0) {
pr_info("Fail to request emi_bw_irqnr interrupt. Error = %d.\n", ret);
return ret;
}
} else
pr_info("[EMI] fail to register elm_irq\n");
elm_valid = 0;
lt_init();
return ret;
}
void suspend_elm(void)
{
unsigned long flags;
int emi_dcm_status;
spin_lock_irqsave(&elm_lock, flags);
emi_dcm_status = BM_GetEmiDcm();
BM_SetEmiDcm(0x40);
/* Clear BM */
mt_reg_sync_writel(readl(IOMEM(EMI_BMEN)) & 0xfffffffc, EMI_BMEN);
/* Disable CGM */
writel(0x0, IOMEM(EMI_CGMA));
/* Disable ELM */
writel(readl(IOMEM(EMI_LTCT0_2ND)) & ~0x1, IOMEM(EMI_LTCT0_2ND));
mt_reg_sync_writel(readl(IOMEM(EMI_LTCT0_2ND)) & ~0x8, EMI_LTCT0_2ND);
BM_SetEmiDcm(emi_dcm_status);
spin_unlock_irqrestore(&elm_lock, flags);
}
void resume_elm(void)
{
if (is_elm_enabled())
lt_init();
}
@@ -0,0 +1,34 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __MT_EMI_ELM_H__
#define __MT_EMI_ELM_H__
#define ENABLE_ELM 1
#define EMI_LTCT0_2ND (CEN_EMI_BASE + 0x750)
#define EMI_LTCT1_2ND (CEN_EMI_BASE + 0x754)
#define EMI_LTCT2_2ND (CEN_EMI_BASE + 0x758)
#define EMI_LTCT3_2ND (CEN_EMI_BASE + 0x75C)
#define EMI_LTST0_2ND (CEN_EMI_BASE + 0x760)
#define EMI_LTST1_2ND (CEN_EMI_BASE + 0x764)
#define EMI_LTST2_2ND (CEN_EMI_BASE + 0x768)
#define EMI_CGMA (CEN_EMI_BASE + 0x720)
#define EMI_CGMA_ST0 (CEN_EMI_BASE + 0x724)
#define EMI_CGMA_ST1 (CEN_EMI_BASE + 0x728)
#define EMI_CGMA_ST2 (CEN_EMI_BASE + 0x72C)
#define EMI_EBMINT_ST (CEN_EMI_BASE + 0x744)
#define LT_CMD_THR_VAL 100
extern int elm_init(unsigned int elm_irq);
extern void elm_dump(char *buf, unsigned int leng);
extern void enable_elm(void);
extern void disable_elm(void);
extern void suspend_elm(void);
extern void resume_elm(void);
extern bool is_elm_enabled(void);
#endif /* !__MT_EMI_BW_ELM_H__ */
@@ -0,0 +1,238 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#include <mt-plat/sync_write.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/sched.h>
#include <linux/sched/clock.h>
#include <asm/div64.h>
#include <mtk_dramc.h>
#include "emi_mbw.h"
#include "emi_bwl.h"
#include "emi_elm.h"
static bool dump_latency_status;
unsigned long long last_time_ns;
long long LastWordAllCount;
void dump_last_bm(char *buf, unsigned int leng)
{
#if ENABLE_ELM
elm_dump(buf, leng);
#else
snprintf(buf, leng, "[EMI] no ELM and runtime BM support\n");
#endif
}
/***********************************************
* register / unregister g_pGetMemBW CB
***********************************************/
static getmembw_func g_pGetMemBW; /* not initialise statics to 0 or NULL */
void mt_getmembw_registerCB(getmembw_func pCB)
{
if (pCB == NULL) {
/* reset last time & word all count */
last_time_ns = sched_clock();
LastWordAllCount = 0;
pr_info("[get_mem_bw] register CB is a null function\n");
} else {
pr_info("[get_mem_bw] register CB successful\n");
}
g_pGetMemBW = pCB;
}
EXPORT_SYMBOL(mt_getmembw_registerCB);
unsigned long long get_mem_bw(void)
{
unsigned long long throughput;
long long WordAllCount;
unsigned long long current_time_ns, time_period_ns;
int count;
long long value;
int emi_dcm_status;
#if DISABLE_FLIPPER_FUNC
return 0;
#endif
if (g_pGetMemBW)
return g_pGetMemBW();
emi_dcm_status = BM_GetEmiDcm();
/* pr_info("[get_mem_bw]emi_dcm_status = %d\n", emi_dcm_status); */
current_time_ns = sched_clock();
time_period_ns = current_time_ns - last_time_ns;
/* pr_info("[get_mem_bw]last_time=%llu, current_time=%llu,
* period=%llu\n", last_time_ns, current_time_ns, time_period_ns);
*/
/* disable_infra_dcm(); */
BM_SetEmiDcm(0xff); /* disable EMI dcm */
BM_Pause();
WordAllCount = BM_GetWordAllCount();
if (WordAllCount == 0) {
LastWordAllCount = 0;
} else if (WordAllCount == BM_ERR_OVERRUN) {
pr_debug("[get_mem_bw] BM_ERR_OVERRUN\n");
WordAllCount = 0;
LastWordAllCount = 0;
BM_Enable(0); /* stop EMI monitors will reset all counters */
BM_Enable(1); /* start EMI monitor counting */
}
WordAllCount -= LastWordAllCount;
throughput = (WordAllCount * 8 * 1000);
if (time_period_ns >= 0xFFFFFFFF) { /* uint32_t overflow */
do_div(time_period_ns, 10000000);
do_div(throughput, 10000000);
pr_debug("[get_mem_bw] time_period_ns overflow lst\n");
/* pr_info("[get_mem_bw] time_period_ns overflow 1st\n"); */
if (time_period_ns >= 0xFFFFFFFF) { /* uint32_t overflow */
do_div(time_period_ns, 1000);
do_div(throughput, 1000);
pr_debug("[get_mem_bw] time_period_ns overflow 2nd\n");
/* pr_info("[get_mem_bw] time_period overflow 2nd\n"); */
}
}
do_div(throughput, time_period_ns);
/* pr_info("[get_mem_bw]Total MEMORY THROUGHPUT =%llu(MB/s),
* WordAllCount_delta = 0x%llx, LastWordAllCount = 0x%llx\n",
* throughput, WordAllCount, LastWordAllCount);
*/
/* stopping EMI monitors will reset all counters */
BM_Enable(0);
value = BM_GetWordAllCount();
count = 100;
if ((value != 0) && (value > 0xB0000000)) {
do {
value = BM_GetWordAllCount();
if (value != 0) {
count--;
BM_Enable(1);
BM_Enable(0);
} else
break;
} while (count > 0);
}
LastWordAllCount = value;
/* pr_info("[get_mem_bw]loop count = %d, last_word_all_count = 0x%llx\n", count, LastWordAllCount); */
/* start EMI monitor counting */
BM_Enable(1);
last_time_ns = sched_clock();
/* restore_infra_dcm();*/
BM_SetEmiDcm(emi_dcm_status);
/*pr_info("[get_mem_bw]throughput = %llx\n", throughput);*/
return throughput;
}
static int mem_bw_suspend_callback(struct device *dev)
{
/*pr_info("[get_mem_bw]mem_bw_suspend_callback\n");*/
LastWordAllCount = 0;
BM_Pause();
return 0;
}
static int mem_bw_resume_callback(struct device *dev)
{
/* pr_info("[get_mem_bw]mem_bw_resume_callback\n"); */
BM_Continue();
return 0;
}
const struct dev_pm_ops mt_mem_bw_pm_ops = {
.suspend = mem_bw_suspend_callback,
.resume = mem_bw_resume_callback,
.restore_early = NULL,
};
struct platform_device mt_mem_bw_pdev = {
.name = "mt-mem_bw",
.id = -1,
};
static struct platform_driver mt_mem_bw_pdrv = {
.probe = NULL,
.remove = NULL,
.driver = {
.name = "mt-mem_bw",
.pm = &mt_mem_bw_pm_ops,
.owner = THIS_MODULE,
},
};
int mbw_init(void)
{
int ret = 0;
BM_Init();
/* register platform device/driver */
ret = platform_device_register(&mt_mem_bw_pdev);
if (ret) {
pr_info("fail to register mem_bw device @ %s()\n", __func__);
goto out;
}
ret = platform_driver_register(&mt_mem_bw_pdrv);
if (ret) {
pr_info("fail to register mem_bw driver @ %s()\n", __func__);
platform_device_unregister(&mt_mem_bw_pdev);
}
enable_dump_latency();
out:
return ret;
}
void enable_dump_latency(void)
{
dump_latency_status = true;
}
void disable_dump_latency(void)
{
dump_latency_status = false;
}
static int __init dvfs_bwct_init(void)
{
return 0;
}
late_initcall(dvfs_bwct_init);
#ifdef ENABLE_RUNTIME_BM
static int __init runtime_bm_init(void)
{
setup_deferrable_timer_on_stack(&bm_timer, bm_timer_callback, 0);
if (mod_timer(&bm_timer, jiffies + msecs_to_jiffies(RUNTIME_PERIOD)))
pr_debug("[EMI MBW] Error in BM mod_timer\n");
return 0;
}
late_initcall(runtime_bm_init);
#endif
@@ -0,0 +1,190 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __MT_MEM_BW_H__
#define __MT_MEM_BW_H__
#define ENABLE_MBW 1
#define DISABLE_FLIPPER_FUNC 0
#ifdef CONFIG_MTK_ENG_BUILD
/* #define ENABLE_RUNTIME_BM */
#endif
#define EMI_BMEN (CEN_EMI_BASE + 0x400)
#define EMI_BCNT (CEN_EMI_BASE + 0x408)
#define EMI_TACT (CEN_EMI_BASE + 0x410)
#define EMI_TSCT (CEN_EMI_BASE + 0x418)
#define EMI_WACT (CEN_EMI_BASE + 0x420)
#define EMI_WSCT (CEN_EMI_BASE + 0x428)
#define EMI_BACT (CEN_EMI_BASE + 0x430)
#define EMI_BSCT (CEN_EMI_BASE + 0x438)
#define EMI_MSEL (CEN_EMI_BASE + 0x440)
#define EMI_TSCT2 (CEN_EMI_BASE + 0x448)
#define EMI_TSCT3 (CEN_EMI_BASE + 0x450)
#define EMI_WSCT2 (CEN_EMI_BASE + 0x458)
#define EMI_WSCT3 (CEN_EMI_BASE + 0x460)
#define EMI_WSCT4 (CEN_EMI_BASE + 0x464)
#define EMI_MSEL2 (CEN_EMI_BASE + 0x468)
#define EMI_MSEL3 (CEN_EMI_BASE + 0x470)
#define EMI_MSEL4 (CEN_EMI_BASE + 0x478)
#define EMI_MSEL5 (CEN_EMI_BASE + 0x480)
#define EMI_MSEL6 (CEN_EMI_BASE + 0x488)
#define EMI_MSEL7 (CEN_EMI_BASE + 0x490)
#define EMI_MSEL8 (CEN_EMI_BASE + 0x498)
#define EMI_MSEL9 (CEN_EMI_BASE + 0x4A0)
#define EMI_MSEL10 (CEN_EMI_BASE + 0x4A8)
#define EMI_BMID0 (CEN_EMI_BASE + 0x4B0)
#define EMI_BMID1 (CEN_EMI_BASE + 0x4B4)
#define EMI_BMID2 (CEN_EMI_BASE + 0x4B8)
#define EMI_BMID3 (CEN_EMI_BASE + 0x4BC)
#define EMI_BMID4 (CEN_EMI_BASE + 0x4C0)
#define EMI_BMID5 (CEN_EMI_BASE + 0x4C4)
#define EMI_BMID6 (CEN_EMI_BASE + 0x4C8)
#define EMI_BMID7 (CEN_EMI_BASE + 0x4CC)
#define EMI_BMID8 (CEN_EMI_BASE + 0x4D0)
#define EMI_BMID9 (CEN_EMI_BASE + 0x4D4)
#define EMI_BMID10 (CEN_EMI_BASE + 0x4D8)
#define EMI_BMEN1 (CEN_EMI_BASE + 0x4E0)
#define EMI_BMEN2 (CEN_EMI_BASE + 0x4E8)
#define EMI_BMRW0 (CEN_EMI_BASE + 0x4F8)
#define EMI_TTYPE1 (CEN_EMI_BASE + 0x500)
#define EMI_TTYPE2 (CEN_EMI_BASE + 0x508)
#define EMI_TTYPE3 (CEN_EMI_BASE + 0x510)
#define EMI_TTYPE4 (CEN_EMI_BASE + 0x518)
#define EMI_TTYPE5 (CEN_EMI_BASE + 0x520)
#define EMI_TTYPE6 (CEN_EMI_BASE + 0x528)
#define EMI_TTYPE7 (CEN_EMI_BASE + 0x530)
#define EMI_TTYPE8 (CEN_EMI_BASE + 0x538)
#define EMI_TTYPE9 (CEN_EMI_BASE + 0x540)
#define EMI_TTYPE10 (CEN_EMI_BASE + 0x548)
#define EMI_TTYPE11 (CEN_EMI_BASE + 0x550)
#define EMI_TTYPE12 (CEN_EMI_BASE + 0x558)
#define EMI_TTYPE13 (CEN_EMI_BASE + 0x560)
#define EMI_TTYPE14 (CEN_EMI_BASE + 0x568)
#define EMI_TTYPE15 (CEN_EMI_BASE + 0x570)
#define EMI_TTYPE16 (CEN_EMI_BASE + 0x578)
#define EMI_TTYPE17 (CEN_EMI_BASE + 0x580)
#define EMI_TTYPE18 (CEN_EMI_BASE + 0x588)
#define EMI_TTYPE19 (CEN_EMI_BASE + 0x590)
#define EMI_TTYPE20 (CEN_EMI_BASE + 0x598)
#define EMI_TTYPE21 (CEN_EMI_BASE + 0x5A0)
#define EMI_TTYPE(i) (EMI_TTYPE1 + (i*8))
#define EMI_BWCT0 (CEN_EMI_BASE + 0x5B0)
#define EMI_BWST0 (CEN_EMI_BASE + 0x5C4)
#define EMI_BWCT0_2ND (CEN_EMI_BASE + 0x6A0)
#define EMI_BWST_2ND (CEN_EMI_BASE + 0x6A8)
#define EMI_BWCT0_3RD (CEN_EMI_BASE + 0x770)
#define EMI_BWST_3RD (CEN_EMI_BASE + 0x778)
#define EMI_BWCT0_4TH (CEN_EMI_BASE + 0x780)
#define EMI_BWST_4TH (CEN_EMI_BASE + 0x788)
enum {
BM_BOTH_READ_WRITE,
BM_READ_ONLY,
BM_WRITE_ONLY
};
enum {
BM_TRANS_TYPE_1BEAT = 0x0,
BM_TRANS_TYPE_2BEAT,
BM_TRANS_TYPE_3BEAT,
BM_TRANS_TYPE_4BEAT,
BM_TRANS_TYPE_5BEAT,
BM_TRANS_TYPE_6BEAT,
BM_TRANS_TYPE_7BEAT,
BM_TRANS_TYPE_8BEAT,
BM_TRANS_TYPE_9BEAT,
BM_TRANS_TYPE_10BEAT,
BM_TRANS_TYPE_11BEAT,
BM_TRANS_TYPE_12BEAT,
BM_TRANS_TYPE_13BEAT,
BM_TRANS_TYPE_14BEAT,
BM_TRANS_TYPE_15BEAT,
BM_TRANS_TYPE_16BEAT,
BM_TRANS_TYPE_1Byte = 0 << 4,
BM_TRANS_TYPE_2Byte = 1 << 4,
BM_TRANS_TYPE_4Byte = 2 << 4,
BM_TRANS_TYPE_8Byte = 3 << 4,
BM_TRANS_TYPE_16Byte = 4 << 4,
BM_TRANS_TYPE_BURST_WRAP = 0 << 7,
BM_TRANS_TYPE_BURST_INCR = 1 << 7
};
#define BM_MASTER_APMCU0 (0x01)
#define BM_MASTER_APMCU1 (0x02)
#define BM_MASTER_MM0 (0x04)
#define BM_MASTER_MDMCU (0x08)
#define BM_MASTER_MD (0x10)
#define BM_MASTER_MM1 (0x20)
#define BM_MASTER_GPU0 (0x40)
#define BM_MASTER_GPU1 (0x80)
#define BM_MASTER_ALL (0xFF)
#define BUS_MON_EN (0x00000001)
#define BUS_MON_PAUSE (0x00000002)
#define BC_OVERRUN (0x00000100)
#define BM_COUNTER_MAX (21)
#define BM_REQ_OK (0)
#define BM_ERR_WRONG_REQ (-1)
#define BM_ERR_OVERRUN (-2)
extern void BM_Init(void);
extern void BM_DeInit(void);
extern void BM_Enable(const unsigned int enable);
extern void BM_Pause(void);
extern void BM_Continue(void);
extern unsigned int BM_IsOverrun(void);
extern void BM_SetReadWriteType(const unsigned int ReadWriteType);
extern int BM_GetBusCycCount(void);
extern unsigned int BM_GetTransAllCount(void);
extern int BM_GetTransCount(const unsigned int counter_num);
extern long long BM_GetWordAllCount(void);
extern int BM_GetWordCount(const unsigned int counter_num);
extern unsigned int BM_GetBandwidthWordCount(void);
extern unsigned int BM_GetOverheadWordCount(void);
extern int BM_GetTransTypeCount(const unsigned int counter_num);
extern int BM_SetMonitorCounter(const unsigned int counter_num,
const unsigned int master, const unsigned int trans_type);
extern int BM_SetMaster(const unsigned int counter_num,
const unsigned int master);
extern int BM_SetIDSelect(const unsigned int counter_num, const unsigned int id,
const unsigned int enable);
extern int BM_SetUltraHighFilter(const unsigned int counter_num,
const unsigned int enable);
extern int BM_SetLatencyCounter(void);
extern int BM_GetLatencyCycle(const unsigned int counter_num);
extern int BM_GetEmiDcm(void);
extern int BM_SetEmiDcm(const unsigned int setting);
extern int BM_SetBW(const unsigned int BW_config);
extern int BM_SetBW2(const unsigned int BW_config);
extern int BM_SetBW3(const unsigned int BW_config);
extern int BM_SetBW4(const unsigned int BW_config);
extern unsigned int BM_GetBWST(void);
extern unsigned int BM_GetBWST2(void);
extern unsigned int BM_GetBWST3(void);
extern unsigned int BM_GetBWST4(void);
extern unsigned int BM_GetBW(void);
extern unsigned int BM_GetBW2(void);
extern unsigned int BM_GetBW3(void);
extern unsigned int BM_GetBW4(void);
extern int mbw_init(void);
extern void enable_dump_latency(void);
extern void disable_dump_latency(void);
extern void dump_emi_latency(void);
extern void dump_emi_outstanding(void);
extern void dump_emi_outstanding_for_md(void);
extern void dump_last_bm(char *buf, unsigned int leng);
typedef unsigned long long (*getmembw_func)(void);
extern void mt_getmembw_registerCB(getmembw_func pCB);
unsigned long long get_mem_bw(void);
#endif /* !__MT_MEM_BW_H__ */
@@ -0,0 +1,958 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#include <mt-plat/mtk_io.h>
#include <mt-plat/sync_write.h>
#ifdef CONFIG_MTK_AEE_FEATURE
#include <mt-plat/aee.h>
#include <mt-plat/mboot_params.h>
#endif
#include <linux/of_address.h>
#include <linux/device.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/delay.h>
#include <mtk_dramc.h>
#include "emi_mbw.h"
#include "emi_bwl.h"
static void __iomem *CEN_EMI_BASE; /* not initialise statics to 0 or NULL */
static void __iomem *CHA_EMI_BASE;
static void __iomem *INFRACFG_BASE;
static void __iomem *INFRA_AO_BASE;
void BM_Init(void)
{
struct device_node *node;
CEN_EMI_BASE = mt_cen_emi_base_get();
CHA_EMI_BASE = mt_chn_emi_base_get();
if (INFRACFG_BASE == NULL) {
node = of_find_compatible_node(NULL, NULL, "mediatek,infracfg");
if (node) {
INFRACFG_BASE = of_iomap(node, 0);
pr_debug("get INFRACFG_BASE@ %p\n", INFRACFG_BASE);
} else
pr_debug("can't find compatible node for INFRACFG_BASE\n");
}
if (INFRA_AO_BASE == NULL) {
node = of_find_compatible_node(NULL, NULL, "mediatek,infracfg_ao");
if (node) {
INFRA_AO_BASE = of_iomap(node, 0);
pr_info("get INFRA_AO_BASE@ %p\n", INFRACFG_BASE);
} else
pr_info("can't find compatible node for INFRA_AO_BASE\n");
}
}
void BM_DeInit(void)
{
}
void BM_Enable(const unsigned int enable)
{
const unsigned int value = readl(IOMEM(EMI_BMEN));
mt_reg_sync_writel((value & ~(BUS_MON_PAUSE | BUS_MON_EN)) |
(enable ? BUS_MON_EN : 0), EMI_BMEN);
}
void BM_Pause(void)
{
const unsigned int value = readl(IOMEM(EMI_BMEN));
mt_reg_sync_writel(value | BUS_MON_PAUSE, EMI_BMEN);
}
void BM_Continue(void)
{
const unsigned int value = readl(IOMEM(EMI_BMEN));
mt_reg_sync_writel(value & (~BUS_MON_PAUSE), EMI_BMEN);
}
unsigned int BM_IsOverrun(void)
{
/*
* return 0 if EMI_BCNT(bus cycle counts)
* or EMI_WACT(total word counts) is overrun,
* otherwise return an !0 value
*/
const unsigned int value = readl(IOMEM(EMI_BMEN));
return value & BC_OVERRUN;
}
void BM_SetReadWriteType(const unsigned int ReadWriteType)
{
const unsigned int value = readl(IOMEM(EMI_BMEN));
/*
* ReadWriteType: 00/11 --> both R/W
* 01 --> only R
* 10 --> only W
*/
mt_reg_sync_writel((value & 0xFFFFFFCF) |
(ReadWriteType << 4), EMI_BMEN);
}
int BM_GetBusCycCount(void)
{
return BM_IsOverrun() ? BM_ERR_OVERRUN : readl(IOMEM(EMI_BCNT));
}
unsigned int BM_GetTransAllCount(void)
{
return readl(IOMEM(EMI_TACT));
}
int BM_GetTransCount(const unsigned int counter_num)
{
unsigned int iCount;
switch (counter_num) {
case 1:
iCount = readl(IOMEM(EMI_TSCT));
break;
case 2:
iCount = readl(IOMEM(EMI_TSCT2));
break;
case 3:
iCount = readl(IOMEM(EMI_TSCT3));
break;
default:
return BM_ERR_WRONG_REQ;
}
return iCount;
}
long long BM_GetWordAllCount(void)
{
unsigned int word_all_count;
word_all_count = readl(IOMEM(EMI_WACT));
if (BM_IsOverrun() && (word_all_count == 0xFFFFFFFF))
return BM_ERR_OVERRUN;
else
return word_all_count;
}
int BM_GetWordCount(const unsigned int counter_num)
{
unsigned int iCount;
switch (counter_num) {
case 1:
iCount = readl(IOMEM(EMI_WSCT));
break;
case 2:
iCount = readl(IOMEM(EMI_WSCT2));
break;
case 3:
iCount = readl(IOMEM(EMI_WSCT3));
break;
case 4:
iCount = readl(IOMEM(EMI_WSCT4));
break;
default:
return BM_ERR_WRONG_REQ;
}
return iCount;
}
unsigned int BM_GetBandwidthWordCount(void)
{
return readl(IOMEM(EMI_BACT));
}
unsigned int BM_GetOverheadWordCount(void)
{
return readl(IOMEM(EMI_BSCT));
}
int BM_GetTransTypeCount(const unsigned int counter_num)
{
return (counter_num < 1 || counter_num > BM_COUNTER_MAX) ?
BM_ERR_WRONG_REQ : readl(IOMEM(EMI_TTYPE1 + (counter_num - 1) * 8));
}
int BM_SetMonitorCounter(const unsigned int counter_num,
const unsigned int master, const unsigned int trans_type)
{
unsigned int value;
unsigned long addr;
const unsigned int iMask = 0xFFFF;
if (counter_num < 1 || counter_num > BM_COUNTER_MAX)
return BM_ERR_WRONG_REQ;
if (counter_num == 1) {
addr = (unsigned long) EMI_BMEN;
value = (readl(IOMEM(addr)) & ~(iMask << 16)) |
((trans_type & 0xFF) << 24) | ((master & 0xFF) << 16);
} else {
addr = (counter_num <= 3) ? (unsigned long) EMI_MSEL :
((unsigned long) EMI_MSEL2 + (counter_num / 2 - 2) * 8);
/* clear master and transaction type fields */
value =
readl(IOMEM(addr)) & ~(iMask << ((counter_num % 2) * 16));
/* set master and transaction type fields */
value |= (((trans_type & 0xFF) << 8) |
(master & 0xFF)) << ((counter_num % 2) * 16);
}
mt_reg_sync_writel(value, addr);
return BM_REQ_OK;
}
int BM_SetMaster(const unsigned int counter_num, const unsigned int master)
{
unsigned int value;
unsigned long addr;
const unsigned int iMask = 0xFF;
if (counter_num < 1 || counter_num > BM_COUNTER_MAX)
return BM_ERR_WRONG_REQ;
if (counter_num == 1) {
addr = (unsigned long) EMI_BMEN;
value = (readl(IOMEM(addr)) & ~(iMask << 16)) |
((master & iMask) << 16);
} else {
addr = (counter_num <= 3) ? (unsigned long) EMI_MSEL :
((unsigned long) EMI_MSEL2 + (counter_num / 2 - 2) * 8);
/* clear master and transaction type fields */
value =
readl(IOMEM(addr)) & ~(iMask << ((counter_num % 2) * 16));
/* set master and transaction type fields */
value |= ((master & iMask) << ((counter_num % 2) * 16));
}
mt_reg_sync_writel(value, addr);
return BM_REQ_OK;
}
int BM_SetIDSelect(const unsigned int counter_num,
const unsigned int id, const unsigned int enable)
{
unsigned int value, shift_num;
unsigned long addr;
if ((counter_num < 1 || counter_num > BM_COUNTER_MAX)
|| (id > 0x1FFF) || (enable > 1))
return BM_ERR_WRONG_REQ;
addr = (unsigned long) EMI_BMID0 + ((counter_num - 1) / 2) * 4;
/* field's offset in the target EMI_BMIDx register */
shift_num = ((counter_num - 1) % 2) * 16;
/* clear SELx_ID field */
value = readl(IOMEM(addr)) & ~(0x1FFF << shift_num);
/* set SELx_ID field */
value |= id << shift_num;
mt_reg_sync_writel(value, addr);
value = (readl(IOMEM(EMI_BMEN2)) & ~(1 << (counter_num - 1))) |
(enable << (counter_num - 1));
mt_reg_sync_writel(value, EMI_BMEN2);
return BM_REQ_OK;
}
int BM_SetUltraHighFilter(const unsigned int counter_num,
const unsigned int enable)
{
unsigned int value;
if ((counter_num < 1 || counter_num > BM_COUNTER_MAX)
|| (enable > 1)) {
return BM_ERR_WRONG_REQ;
}
value = (readl(IOMEM(EMI_BMEN1)) & ~(1 << (counter_num - 1))) |
(enable << (counter_num - 1));
mt_reg_sync_writel(value, EMI_BMEN1);
return BM_REQ_OK;
}
int BM_SetLatencyCounter(void)
{
unsigned int value;
value = readl(IOMEM(EMI_BMEN2)) & ~(0x3 << 24);
/* emi_ttype1 -- emi_ttype8 change as total latencies for m0 -- m7,
* and emi_ttype9 -- emi_ttype16 change
* as total transaction counts for m0 -- m7
*/
value |= (0x2 << 24);
mt_reg_sync_writel(value, EMI_BMEN2);
return BM_REQ_OK;
}
int BM_GetLatencyCycle(const unsigned int counter_num)
{
unsigned int cycle_count;
switch (counter_num) {
case 1:
cycle_count = readl(IOMEM(EMI_TTYPE1));
break;
case 2:
cycle_count = readl(IOMEM(EMI_TTYPE2));
break;
case 3:
cycle_count = readl(IOMEM(EMI_TTYPE3));
break;
case 4:
cycle_count = readl(IOMEM(EMI_TTYPE4));
break;
case 5:
cycle_count = readl(IOMEM(EMI_TTYPE5));
break;
case 6:
cycle_count = readl(IOMEM(EMI_TTYPE6));
break;
case 7:
cycle_count = readl(IOMEM(EMI_TTYPE7));
break;
case 8:
cycle_count = readl(IOMEM(EMI_TTYPE7));
break;
case 9:
cycle_count = readl(IOMEM(EMI_TTYPE9));
break;
case 10:
cycle_count = readl(IOMEM(EMI_TTYPE10));
break;
case 11:
cycle_count = readl(IOMEM(EMI_TTYPE11));
break;
case 12:
cycle_count = readl(IOMEM(EMI_TTYPE12));
break;
case 13:
cycle_count = readl(IOMEM(EMI_TTYPE13));
break;
case 14:
cycle_count = readl(IOMEM(EMI_TTYPE14));
break;
case 15:
cycle_count = readl(IOMEM(EMI_TTYPE15));
break;
case 16:
cycle_count = readl(IOMEM(EMI_TTYPE16));
break;
default:
return BM_ERR_WRONG_REQ;
}
return cycle_count;
}
int BM_GetEmiDcm(void)
{
return readl(IOMEM(EMI_CONM)) >> 24;
}
int BM_SetEmiDcm(const unsigned int setting)
{
unsigned int value;
value = readl(IOMEM(EMI_CONM));
mt_reg_sync_writel((value & 0x00FFFFFF) | (setting << 24), EMI_CONM);
return BM_REQ_OK;
}
unsigned int BM_GetBWST(void)
{
return readl(IOMEM(EMI_BWST0));
}
unsigned int BM_GetBWST2(void)
{
return readl(IOMEM(EMI_BWST_2ND));
}
unsigned int BM_GetBWST3(void)
{
return readl(IOMEM(EMI_BWST_3RD));
}
unsigned int BM_GetBWST4(void)
{
return readl(IOMEM(EMI_BWST_4TH));
}
int BM_SetBW(const unsigned int BW_config)
{
mt_reg_sync_writel(BW_config, EMI_BWCT0);
return BM_REQ_OK;
}
int BM_SetBW2(const unsigned int BW_config)
{
mt_reg_sync_writel(BW_config, EMI_BWCT0_2ND);
return BM_REQ_OK;
}
int BM_SetBW3(const unsigned int BW_config)
{
mt_reg_sync_writel(BW_config, EMI_BWCT0_3RD);
return BM_REQ_OK;
}
int BM_SetBW4(const unsigned int BW_config)
{
mt_reg_sync_writel(BW_config, EMI_BWCT0_4TH);
return BM_REQ_OK;
}
unsigned int BM_GetBW(void)
{
return readl(IOMEM(EMI_BWCT0));
}
unsigned int BM_GetBW2(void)
{
return readl(IOMEM(EMI_BWCT0_2ND));
}
unsigned int BM_GetBW3(void)
{
return readl(IOMEM(EMI_BWCT0_3RD));
}
unsigned int BM_GetBW4(void)
{
return readl(IOMEM(EMI_BWCT0_4TH));
}
static inline void aee_simple_print(const char *msg, unsigned int val)
{
char buf[128];
int err;
err = snprintf(buf, sizeof(buf), msg, val);
#ifdef CONFIG_MTK_AEE_FEATURE
if (err > 0)
aee_sram_fiq_log(buf);
#endif
}
#define EMI_DBG_SIMPLE_RWR(msg, addr, wval) do {\
aee_simple_print(msg, readl(addr)); \
writel(wval, addr); \
aee_simple_print(msg, readl(addr));\
} while (0)
#define EMI_DBG_SIMPLE_R(msg, addr) \
aee_simple_print(msg, readl(addr))
void dump_emi_outstanding(void)
{
#if 0
/* CEN_EMI_BASE: 0x10219000 */
if (!CEN_EMI_BASE)
return;
/* CHA_EMI_BASE: 0x1022D000 */
if (!CHA_EMI_BASE)
return;
/* CHB_EMI_BASE: 0x10235000 */
if (!CHB_EMI_BASE)
return;
/* INFRACFG_BASE: 0x1020E000 */
if (!INFRACFG_BASE)
return;
EMI_DBG_SIMPLE_R("[EMI] 0x10001220 = 0x%x\n",
(INFRA_AO_BASE + 0x220));
EMI_DBG_SIMPLE_R("[EMI] 0x10001224 = 0x%x\n",
(INFRA_AO_BASE + 0x224));
EMI_DBG_SIMPLE_R("[EMI] 0x10001228 = 0x%x\n",
(INFRA_AO_BASE + 0x228));
EMI_DBG_SIMPLE_R("[EMI] 0x10001250 = 0x%x\n",
(INFRA_AO_BASE + 0x250));
EMI_DBG_SIMPLE_R("[EMI] 0x10001254 = 0x%x\n",
(INFRA_AO_BASE + 0x254));
EMI_DBG_SIMPLE_R("[EMI] 0x10001258 = 0x%x\n",
(INFRA_AO_BASE + 0x258));
EMI_DBG_SIMPLE_RWR("[EMI] 0x102190e8 = 0x%x\n",
(CEN_EMI_BASE + 0x0e8), readl(CEN_EMI_BASE + 0x0e8) | 0x100);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00000104 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00000204 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00000304 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00000404 >> 3);
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00000804 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00000904 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00001204 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00001104 >> 3);
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00000504 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00000604 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00000a04 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00000b04 >> 3);
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00001504 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00001604 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00001704 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00001804 >> 3);
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00001904 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00001a04 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00001b04 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00001c04 >> 3);
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00003600 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00003700 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00003800 >> 3);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00003900 >> 3);
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da80 = 0x%x\n",
(CHA_EMI_BASE + 0xa80), 0x00000001);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x00120000);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x00180017);
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x00160015);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x00180017);
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x001a0019);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x0001001b);
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x00370036);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x00390038);
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x00050004);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x00070006);
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x000e0008);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x0010000f);
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x000a0009);
EMI_DBG_SIMPLE_RWR("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x000c000b);
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a80 = 0x%x\n",
(CHB_EMI_BASE + 0xa80), 0x00000001);
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x00120000);
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x00180017);
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x00160015);
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x00180017);
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x001a0019);
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x0001001b);
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x00370036);
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x00390038);
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x00050004);
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x00070006);
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x000e0008);
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x0010000f);
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x000a0009);
EMI_DBG_SIMPLE_RWR("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x000c000b);
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
#endif
}
#define EMI_DBG_SIMPLE_RWR_MD(msg, addr, wval) do {\
pr_debug(msg, readl(addr)); \
writel(wval, addr); \
pr_debug(msg, readl(addr));\
} while (0)
#define EMI_DBG_SIMPLE_R_MD(msg, addr) \
pr_debug(msg, readl(addr))
void dump_emi_outstanding_for_md(void)
{
#if 0
/* CEN_EMI_BASE: 0x10219000 */
if (!CEN_EMI_BASE)
return;
/* CHA_EMI_BASE: 0x1022D000 */
if (!CHA_EMI_BASE)
return;
/* CHB_EMI_BASE: 0x10235000 */
if (!CHB_EMI_BASE)
return;
/* INFRACFG_BASE: 0x1020E000 */
if (!INFRACFG_BASE)
return;
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x102190e8 = 0x%x\n",
(CEN_EMI_BASE + 0x0e8), readl(CEN_EMI_BASE + 0x0e8) | 0x100);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00000104 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00000204 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00000304 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00000404 >> 3);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00000804 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00000904 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00001204 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00001104 >> 3);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00001504 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00001604 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00001704 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00001804 >> 3);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00001904 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00001a04 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00001b04 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00001c04 >> 3);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e100 = 0x%x\n",
(INFRACFG_BASE + 0x100), 0x00003600 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e104 = 0x%x\n",
(INFRACFG_BASE + 0x104), 0x00003700 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e108 = 0x%x\n",
(INFRACFG_BASE + 0x108), 0x00003800 >> 3);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1020e10c = 0x%x\n",
(INFRACFG_BASE + 0x10c), 0x00003900 >> 3);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x102197fc = 0x%x\n",
(CEN_EMI_BASE + 0x7fc));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da80 = 0x%x\n",
(CHA_EMI_BASE + 0xa80), 0x00000001);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x00120000);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x00180017);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x00160015);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x00180017);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x001a0019);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x0001001b);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x00370036);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x00390038);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x00050004);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x00070006);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x000e0008);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x0010000f);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da88 = 0x%x\n",
(CHA_EMI_BASE + 0xa88), 0x000a0009);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x1022da8c = 0x%x\n",
(CHA_EMI_BASE + 0xa8c), 0x000c000b);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x1022da84 = 0x%x\n",
(CHA_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a80 = 0x%x\n",
(CHB_EMI_BASE + 0xa80), 0x00000001);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x00120000);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x00180017);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x00160015);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x00180017);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x001a0019);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x0001001b);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x00370036);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x00390038);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x00050004);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x00070006);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x000e0008);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x0010000f);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a88 = 0x%x\n",
(CHB_EMI_BASE + 0xa88), 0x000a0009);
EMI_DBG_SIMPLE_RWR_MD("[EMI] 0x10235a8c = 0x%x\n",
(CHB_EMI_BASE + 0xa8c), 0x000c000b);
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
EMI_DBG_SIMPLE_R_MD("[EMI] 0x10235a84 = 0x%x\n",
(CHB_EMI_BASE + 0xa84));
#endif
}
void dump_emi_latency(void)
{
/* legacy API */
return;
}