linux/drivers/memory/mtk-smi.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2016 MediaTek Inc.
 * Author: Yong Wu <[email protected]>
 */
#include <linux/arm-smccc.h>
#include <linux/clk.h>
#include <linux/component.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/soc/mediatek/mtk_sip_svc.h>
#include <soc/mediatek/smi.h>
#include <dt-bindings/memory/mt2701-larb-port.h>
#include <dt-bindings/memory/mtk-memory-port.h>

/* SMI COMMON */
#define SMI_L1LEN

#define SMI_L1_ARB
#define SMI_BUS_SEL
#define SMI_BUS_LARB_SHIFT(larbid)
/* All are MMU0 defaultly. Only specialize mmu1 here. */
#define F_MMU1_LARB(larbid)

#define SMI_READ_FIFO_TH
#define SMI_M4U_TH
#define SMI_FIFO_TH1
#define SMI_FIFO_TH2
#define SMI_DCM
#define SMI_DUMMY

/* SMI LARB */
#define SMI_LARB_SLP_CON
#define SLP_PROT_EN
#define SLP_PROT_RDY

#define SMI_LARB_CMD_THRT_CON
#define SMI_LARB_THRT_RD_NU_LMT_MSK
#define SMI_LARB_THRT_RD_NU_LMT

#define SMI_LARB_SW_FLAG
#define SMI_LARB_SW_FLAG_1

#define SMI_LARB_OSTDL_PORT
#define SMI_LARB_OSTDL_PORTx(id)

/* Below are about mmu enable registers, they are different in SoCs */
/* gen1: mt2701 */
#define REG_SMI_SECUR_CON_BASE

/* every register control 8 port, register offset 0x4 */
#define REG_SMI_SECUR_CON_OFFSET(id)
#define REG_SMI_SECUR_CON_ADDR(id)

/*
 * every port have 4 bit to control, bit[port + 3] control virtual or physical,
 * bit[port + 2 : port + 1] control the domain, bit[port] control the security
 * or non-security.
 */
#define SMI_SECUR_CON_VAL_MSK(id)
#define SMI_SECUR_CON_VAL_VIRT(id)
/* mt2701 domain should be set to 3 */
#define SMI_SECUR_CON_VAL_DOMAIN(id)

/* gen2: */
/* mt8167 */
#define MT8167_SMI_LARB_MMU_EN

/* mt8173 */
#define MT8173_SMI_LARB_MMU_EN

/* general */
#define SMI_LARB_NONSEC_CON(id)
#define F_MMU_EN
#define BANK_SEL(id)

#define SMI_COMMON_INIT_REGS_NR
#define SMI_LARB_PORT_NR_MAX

#define MTK_SMI_FLAG_THRT_UPDATE
#define MTK_SMI_FLAG_SW_FLAG
#define MTK_SMI_FLAG_SLEEP_CTL
#define MTK_SMI_FLAG_CFG_PORT_SEC_CTL
#define MTK_SMI_CAPS(flags, _x)

struct mtk_smi_reg_pair {};

enum mtk_smi_type {};

/* larbs: Require apb/smi clocks while gals is optional. */
static const char * const mtk_smi_larb_clks[] =;
#define MTK_SMI_LARB_REQ_CLK_NR
#define MTK_SMI_LARB_OPT_CLK_NR

/*
 * common: Require these four clocks in has_gals case. Otherwise, only apb/smi are required.
 * sub common: Require apb/smi/gals0 clocks in has_gals case. Otherwise, only apb/smi are required.
 */
static const char * const mtk_smi_common_clks[] =;
#define MTK_SMI_CLK_NR_MAX
#define MTK_SMI_COM_REQ_CLK_NR
#define MTK_SMI_COM_GALS_REQ_CLK_NR
#define MTK_SMI_SUB_COM_GALS_REQ_CLK_NR

struct mtk_smi_common_plat {};

struct mtk_smi_larb_gen {};

struct mtk_smi {};

struct mtk_smi_larb {};

static int
mtk_smi_larb_bind(struct device *dev, struct device *master, void *data)
{}

static void
mtk_smi_larb_unbind(struct device *dev, struct device *master, void *data)
{}

static const struct component_ops mtk_smi_larb_component_ops =;

static int mtk_smi_larb_config_port_gen1(struct device *dev)
{}

static int mtk_smi_larb_config_port_mt8167(struct device *dev)
{}

static int mtk_smi_larb_config_port_mt8173(struct device *dev)
{}

static int mtk_smi_larb_config_port_gen2_general(struct device *dev)
{}

static const u8 mtk_smi_larb_mt8188_ostd[][SMI_LARB_PORT_NR_MAX] =;

static const u8 mtk_smi_larb_mt8195_ostd[][SMI_LARB_PORT_NR_MAX] =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt2701 =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt2712 =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt6779 =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt8167 =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt8173 =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt8183 =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt8186 =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt8188 =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt8192 =;

static const struct mtk_smi_larb_gen mtk_smi_larb_mt8195 =;

static const struct of_device_id mtk_smi_larb_of_ids[] =;
MODULE_DEVICE_TABLE(of, mtk_smi_larb_of_ids);

static int mtk_smi_larb_sleep_ctrl_enable(struct mtk_smi_larb *larb)
{}

static void mtk_smi_larb_sleep_ctrl_disable(struct mtk_smi_larb *larb)
{}

static int mtk_smi_device_link_common(struct device *dev, struct device **com_dev)
{}

static int mtk_smi_dts_clk_init(struct device *dev, struct mtk_smi *smi,
				const char * const clks[],
				unsigned int clk_nr_required,
				unsigned int clk_nr_optional)
{}

static int mtk_smi_larb_probe(struct platform_device *pdev)
{}

static void mtk_smi_larb_remove(struct platform_device *pdev)
{}

static int __maybe_unused mtk_smi_larb_resume(struct device *dev)
{}

static int __maybe_unused mtk_smi_larb_suspend(struct device *dev)
{}

static const struct dev_pm_ops smi_larb_pm_ops =;

static struct platform_driver mtk_smi_larb_driver =;

static const struct mtk_smi_reg_pair mtk_smi_common_mt6795_init[SMI_COMMON_INIT_REGS_NR] =;

static const struct mtk_smi_reg_pair mtk_smi_common_mt8195_init[SMI_COMMON_INIT_REGS_NR] =;

static const struct mtk_smi_common_plat mtk_smi_common_gen1 =;

static const struct mtk_smi_common_plat mtk_smi_common_gen2 =;

static const struct mtk_smi_common_plat mtk_smi_common_mt6779 =;

static const struct mtk_smi_common_plat mtk_smi_common_mt6795 =;

static const struct mtk_smi_common_plat mtk_smi_common_mt8183 =;

static const struct mtk_smi_common_plat mtk_smi_common_mt8186 =;

static const struct mtk_smi_common_plat mtk_smi_common_mt8188_vdo =;

static const struct mtk_smi_common_plat mtk_smi_common_mt8188_vpp =;

static const struct mtk_smi_common_plat mtk_smi_common_mt8192 =;

static const struct mtk_smi_common_plat mtk_smi_common_mt8195_vdo =;

static const struct mtk_smi_common_plat mtk_smi_common_mt8195_vpp =;

static const struct mtk_smi_common_plat mtk_smi_sub_common_mt8195 =;

static const struct mtk_smi_common_plat mtk_smi_common_mt8365 =;

static const struct of_device_id mtk_smi_common_of_ids[] =;
MODULE_DEVICE_TABLE(of, mtk_smi_common_of_ids);

static int mtk_smi_common_probe(struct platform_device *pdev)
{}

static void mtk_smi_common_remove(struct platform_device *pdev)
{}

static int __maybe_unused mtk_smi_common_resume(struct device *dev)
{}

static int __maybe_unused mtk_smi_common_suspend(struct device *dev)
{}

static const struct dev_pm_ops smi_common_pm_ops =;

static struct platform_driver mtk_smi_common_driver =;

static struct platform_driver * const smidrivers[] =;

static int __init mtk_smi_init(void)
{}
module_init();

static void __exit mtk_smi_exit(void)
{}
module_exit(mtk_smi_exit);

MODULE_DESCRIPTION();
MODULE_LICENSE();