Steps to include lima in 4-19-main (latest)
git clone --depth=10 --single-branch --branch=lima-4.19-rc4 https://gitlab.freedesktop.org/lima/linux/ lima-4.19-rc4
mkdir 4.19-main/drivers/gpu/drm/lima
cp lima-4.19-rc4/drivers/gpu/drm/lima/* 4.19-main/drivers/gpu/drm/lima/
cp lima-4.19-rc/include/uapi/drm/lima_drm.h 4.19-main/include/uapi/drm/
edit 4.19-main/drivers/gpu/drm/Makefile
add to end: obj-$(CONFIG_DRM_LIMA) += lima/
edit 4.19-main/drivers/gpu/drm/Kconfig
Add latest source: source "drivers/gpu/drm/lima/Kconfig"
Then edit arch/arm/configs/mt7623n_evb_fwu_defconfig
add:
CONFIG_DRM_LIMA=m
CONFIG_F2FS_FS=y
CONFIG_COMMON_CLK_MT2701_G3DSYS=y
Edit: 4.19-main/arc/arm/boot/dts/mt7623.dtsi
Add:
mali: gpu@13040000 {
compatible = "mediatek,mt7623-mali", "arm,mali-450";
reg = <0 0x13040000 0 0x30000>;
interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 171 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 172 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 173 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 174 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 175 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 176 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 177 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 178 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 179 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 180 IRQ_TYPE_LEVEL_LOW>;
interrupt-names = "gp", "gpmmu", "pp0", "ppmmu0", "pp1",
"ppmmu1", "pp2", "ppmmu2", "pp3", "ppmmu3",
"pp";
clocks = <&topckgen CLK_TOP_MMPLL>,
<&g3dsys CLK_G3DSYS_CORE>;
clock-names = "bus", "core";
power-domains = <&scpsys MT2701_POWER_DOMAIN_MFG>;
resets = <&g3dsys MT2701_G3DSYS_CORE_RST>;
};
build && install && boot
[ 14.288947] lima: unknown parameter 'debug' ignored
[ 14.290425] lima 13040000.gpu: bus rate = 500500000
[ 14.290439] lima 13040000.gpu: mod rate = 500500000
[ 14.295731] lima 13040000.gpu: mmu gpmmu dte write test fail
[ 14.298761] lima 13040000.gpu: ttm finalized
[ 14.298796] lima 13040000.gpu: Fatal error during GPU init
[ 14.298941] lima: probe of 13040000.gpu failed with error -5
rmmod lima
devmem2 0x10003014 w 0x00000001
modprobe lima
[ 275.840275] lima 13040000.gpu: bus rate = 500500000
[ 275.840290] lima 13040000.gpu: mod rate = 500500000
[ 275.842618] lima 13040000.gpu: gp - mali450 version major 0 minor 0
[ 275.842677] lima 13040000.gpu: pp0 - mali450 version major 0 minor 0
[ 275.842727] lima 13040000.gpu: pp1 - mali450 version major 0 minor 0
[ 275.842778] lima 13040000.gpu: pp2 - mali450 version major 0 minor 0
[ 275.842932] lima 13040000.gpu: pp3 - mali450 version major 0 minor 0
[ 275.842999] lima 13040000.gpu: l2 cache 8K, 4-way, 64byte cache line, 128bit external bus
[ 275.843009] lima 13040000.gpu: l2 cache 128K, 4-way, 64byte cache line, 128bit external bus
[ 275.845825] [drm] Initialized lima 1.0.0 20170325 for 13040000.gpu on minor 1
Added to: drivers/gpu/drm/lima/lima_device.c
int lima_device_init(struct lima_device *ldev)
{
int err, i;
struct resource *res;
#ifdef CONFIG_MTK_COMBO_CHIP_CONSYS_7623
void __iomem *wakeup_register;
wakeup_register = ioremap(0x10003014 , 0x04);
writel(0x00000001,wakeup_register); // this may be wrong, may need bitbang 0th bit to 1
iounmap(wakeup_register);
mdelay(1000);
#endif
Enjoy. braah it seems to need some time to wake up. But now it works if unload and reload lima… (no need to tweak devmem more…)
Edit: added delay it need also #include <linux/delay.h>
There is still something odd, it need to load twice until it works.
#ifdef CONFIG_MTK_COMBO_CHIP_CONSYS_7623
void __iomem *wakeup_register;
wakeup_register = ioremap(0x10003014 , 0x04);
writel(0x00000001,wakeup_register); // this may be wrong, may need bitbang 0th bit to 1
iounmap(wakeup_register);
mdelay(100);
wakeup_register = ioremap(0x10003000 , 0x04); // this is global reset register!!
writel(0x00000010,wakeup_register); // this may be wrong, may need bitbang 5th bit to 1
iounmap(wakeup_register);
mdelay(100);
#endif
Tryed GPU reset…