memory: mediatek emi: add MediaTek EMI driver
Subsystems (4)
PATCH 1/1 memory: mediatek emi: add MediaTek EMI driver
This patch set adds MediaTek EMI drivers.
MediaTek External Memory Interface(emi) on MT6779 SoC controls all the transitions from master to dram, there are emi-cen & emi-mpu drivers.
_______________________________________________
Linux-mediatek mailing list [email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 1/3 memory: Add support for MediaTek External Memory Interface driver
MediaTek External Memory Interface(emi) on MT6779 SoC controls all the transitions from master to dram, there are emi-cen & emi-mpu drivers.
emi-cen driver provides phy addr to dram rank, bank, column and other information, as well as the currently used dram channel number, rank number, rank size.
emi-mpu (memory protect unit) driver provides an interface to set emi regions, need to enter the secure world setting and the violation irq isr will collect mpu violation information, after all regions have protected their respective regions, emi-mpu will set the ap region to protect all the remaining dram.
--- drivers/memory/Kconfig | 1 + drivers/memory/Makefile | 1 + drivers/memory/mediatek/Kconfig | 23 + drivers/memory/mediatek/Makefile | 4 + drivers/memory/mediatek/emi-cen.c | 1305 ++++++++++++++++++++++++++++++ drivers/memory/mediatek/emi-mpu.c | 908 +++++++++++++++++++++ include/linux/soc/mediatek/mtk_sip_svc.h | 3 + include/soc/mediatek/emi.h | 101 +++ 8 files changed, 2346 insertions(+) create mode 100644 drivers/memory/mediatek/Kconfig create mode 100644 drivers/memory/mediatek/Makefile create mode 100644 drivers/memory/mediatek/emi-cen.c create mode 100644 drivers/memory/mediatek/emi-mpu.c create mode 100644 include/soc/mediatek/emi.h
drivers/memory/Kconfig +1 -0
@@ -218,5 +218,6 @@ config STM32_FMC2_EBI source "drivers/memory/samsung/Kconfig" source "drivers/memory/tegra/Kconfig" +source "drivers/memory/mediatek/Kconfig" endif
drivers/memory/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_RENESAS_RPCIF) += renesas-rpc-if.o obj-$(CONFIG_STM32_FMC2_EBI) += stm32-fmc2-ebi.o obj-$(CONFIG_SAMSUNG_MC) += samsung/ +obj-$(CONFIG_HAVE_MTK_MC) += mediatek/ obj-$(CONFIG_TEGRA_MC) += tegra/ obj-$(CONFIG_TI_EMIF_SRAM) += ti-emif-sram.o ti-emif-sram-objs := ti-emif-pm.o ti-emif-sram-pm.o
drivers/memory/mediatek/Kconfig new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 + +config HAVE_MTK_MC + bool "MediaTek Memory Controller support" + select MTK_EMI + help + Support for the Memory Controller (MC) devices found on + MediaTek(R) SoCs. + This config enables MTK_EMI and MTK_DRAMC for EMI and + DRAMC drivers. + +if HAVE_MTK_MC + +config MTK_EMI + tristate "MediaTek External Memory Interface driver" + depends on HAVE_MTK_MC + help + This selects the MediaTek(R) EMI driver. + Provide the API for MPU registration, EMI MPU violation handling, + the API for EMI information, the BWL golden setting, + and the sysfs for EMI ISU control. + +endif
drivers/memory/mediatek/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_MTK_EMI) += emi.o +emi-objs := emi-cen.o +obj-$(CONFIG_MTK_EMI) += emi-mpu.o
drivers/memory/mediatek/emi-cen.c new file +1305 -0
1,305 lines not on this page · raw message
drivers/memory/mediatek/emi-mpu.c new file +908 -0
908 lines not on this page · raw message
include/linux/soc/mediatek/mtk_sip_svc.h +3 -0
@@ -21,5 +21,8 @@#define MTK_SIP_SMC_CMD (fn_id) \ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, MTK_SIP_SMC_CONVENTION, \ ARM_SMCCC_OWNER_SIP, fn_id) +/* EMI MPU */ +#define MTK_SIP_EMIMPU_CONTROL \ + MTK_SIP_SMC_CMD(0x50B)#endif
include/soc/mediatek/emi.h new file +101 -0
101 lines not on this page · raw message
Signature · 5 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v1 1/3] memory: Add support for MediaTek External Memory Interface driver
Quoted 14 lines · EastL Lee
MediaTek External Memory Interface(emi) on MT6779 SoC controls all the transitions from master to dram, there are emi-cen & emi-mpu drivers.
emi-cen driver provides phy addr to dram rank, bank, column and other information, as well as the currently used dram channel number, rank number, rank size.
emi-mpu (memory protect unit) driver provides an interface to set emi regions, need to enter the secure world setting and the violation irq isr will collect mpu violation information, after all regions have protected their respective regions, emi-mpu will set the ap region to protect all the remaining dram.
Signed-off-by EastL Lee <[email protected]>
Quoted 16 lines
--- drivers/memory/Kconfig | 1 + drivers/memory/Makefile | 1 + drivers/memory/mediatek/Kconfig | 23 + drivers/memory/mediatek/Makefile | 4 + drivers/memory/mediatek/emi-cen.c | 1305 ++++++++++++++++++++++++++++++ drivers/memory/mediatek/emi-mpu.c | 908 +++++++++++++++++++++ include/linux/soc/mediatek/mtk_sip_svc.h | 3 + include/soc/mediatek/emi.h | 101 +++ 8 files changed, 2346 insertions(+) create mode 100644 drivers/memory/mediatek/Kconfig create mode 100644 drivers/memory/mediatek/Makefile create mode 100644 drivers/memory/mediatek/emi-cen.c create mode 100644 drivers/memory/mediatek/emi-mpu.c create mode 100644 include/soc/mediatek/emi.h
Use scripts/get_maintainers.pl to get list of people you need to Cc.
Run checkpatch, smatch, sparse and coccinelle on your new driver. I can easily see that some of these steps were missing (e.g. OWNER field...).
Best regards,
Krzysztof
PATCH 2/3 arm64: dts: mt6779: add emi node
In reply to EastL Leeadd emicen & emichn & emimpu node
--- arch/arm64/boot/dts/mediatek/mt6779.dtsi | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
arch/arm64/boot/dts/mediatek/mt6779.dtsi +34 -0
@@ -267,5 +267,39 @@ #clock-cells = <1>; }; + emichn: emichn@10235000 { + compatible = "mediatek,mt6779-emichn", + "mediatek,common-emichn"; + reg = <0 0x10235000 0 0x1000>, + <0 0x10245000 0 0x1000>; + }; + + emicen: emicen@10219000 { + compatible = "mediatek,mt6779-emicen", + "mediatek,common-emicen"; + reg = <0 0x10219000 0 0x1000>; + mediatek,emi-reg = <&emichn>; + }; + + emimpu:emimpu@10226000 { + compatible = "mediatek,mt6779-emimpu", + "mediatek,common-emimpu"; + reg = <0 0x10226000 0 0x1000>; + mediatek,emi-reg = <&emicen>; + interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH 0>; + region_cnt = <32>; + domain_cnt = <16>; + addr_align = <16>; + ap_region = <31>; + ap_apc = <0 5 5 5 0 0 6 5>, + <0 0 5 0 0 1 5 5>; + dump = <0x1f0 0x1f8 0x1fc>; + clear = <0x160 0xffffffff 16>, + <0x200 0x00000003 16>, + <0x1f0 0x80000000 1>; + clear_md = <0x1fc 0x80000000 1>; + ctrl_intf = <1>; + slverr = <0>; + }; }; };
Signature · 5 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 3/3 arm64: configs: mt6779: enable HAVE_MTK_MC config
In reply to EastL Leeenable HAVE_MTK_MC config
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -1091,3 +1091,4 @@ CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_PREEMPT is not set # CONFIG_FTRACE is not set CONFIG_MEMTEST=y +CONFIG_HAVE_MTK_MC=y
Signature · 5 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek