Mali-450 support by lima

what about irq-remapping (hardware-interrupts causing software interrupt)? so other id’s do not cause issue…any idea if the regulator is needed?

In official documents there is little information about mali, but some GPU power registers is opened. It may need power on before is usable. But I don’t know how to check such register value (and need to browse document, because search is not functional. It is in power section. Brr…)

search does not work if viewing in google docs

download it and open with pdf viewer :wink: but i’ve found nothing mali/lima/g3d related

Yes.

It’s because lima driver wasn’t initialized.

Only suggest: irq num in dts is a SoC hw interrupt/Soc pin/etc i.e. SoC internals, linux irq numbers is a linux internals. You can see - it may change ftom boot to boot.

Probably different init scheme, obsolete dts, i definetly didn’t added it to my lost worked lima :frowning: Did you find it’s description in dts? may be it was renamed or moved?

Found very first compiled kernel from my lima branch - doesn’t work - same gpmmu error.

BTW did anyone tried this kernel ? i’ve tried, it compiled successfully, but didn’t booted, at all

enter uImage-name: uImage-4.16-mt                                                                                                                                                                                                                   
kernelinput=uImage-4.16-mt                                                                                                                                                                                                                          
bootargs=board=bpi-r2 console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200  root=/dev/sdb1 rootfstype=ext4 rootwait vmalloc=496M debug=7 initcall_debug=0 video=1920x1080 drm.debug=0x7                                                
5979198 bytes read in 295 ms (19.3 MiB/s)                                                                                                                                                                                                           
## Booting kernel from Legacy Image at 80200000 ...                                                                                                                                                                                                 
  Image Name:   Linux Kernel 4.16.0-rc5mediatek-                                                                                                                                                                                                   
  Image Type:   ARM Linux Kernel Image (uncompressed)                                                                                                                                                                                              
  Data Size:    5979134 Bytes = 5.7 MiB                                                                                                                                                                                                            
  Load Address: 80008000                                                                                                                                                                                                                           
  Entry Point:  80008000                                                                                                                                                                                                                           
  Verifying Checksum ... OK                                                                                                                                                                                                                        
  Loading Kernel Image ... OK                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                   
Starting kernel ...

Thats all… i used defconfig from my lima branch (with g3d enabled) anf Frank’s build script.

this looks like swap uart (put uart2 on top to be ttyS0) is missing. but you can try remove “console=ttyS0,115200” from your cmdline because alias to uart2 is set

Ok, i’ll try.

But a actually need it. :slight_smile: I have monitorless configuration. When monitor was connetted - it showed “No signal”

Yep now search work so it is easy to find:

bit num
5 GCPU_S        W_RST GCPU_SW_RST GCPU software reset
0: Not reset GCPU
1: Reset GCPU

0 GCPU_P        DN GCPU_PDN GCPU power down
0: keep original value
1: Power down GCPU

0 GCPU_P        DN GCPU_PDN GCPU clear power down
0: keep original value
1: clear power down GCPU

0 GCPU_P        DN GCPU_PDN GCPU power down
0: keep original value
1: Power down GCPU

Yep I did. Same result it don’t boot.

hdmi-driver will not be included in this setup, but alias (sorry choose+alias) should set uart2 as stdout

if you want to keep your cmdline, you have to move uart2 over uart0 (to be mapped as ttyS0) in mt7623.dtsi like in my kernels

you can install ssh-client on your system to have a backup-access (i guess you did it already)

If use gentoo then you need usually: echo 0 > /sys/class/graphics/fb0/blank

Never had such problem before none on PC neither on any PIs. :slight_smile:

Done - works.

ap0 din’t up (no driver :wink: ) and i forgot about LAN :blush:

It booted, lima works (atleast successfully inited.) bootlog:

lima-mt.txt (30.8 КБ)

config:

config.txt (143.7 КБ)

So dts is position sensitive. IMHO it’s likely that g3dclk/mali/something else in our branches isn’t on it’s place (just diff dtsi). Also i can try to merge mediatek’s lima driver to my 4.16-lima branch. And of course try to build 4-16-lima with working config (i think it won’t help).

But! everything i can try is only tomorrow - it’s 2:30 am on my clocks :slight_smile:

https://drive.google.com/open?id=1j0RIX66GAVfscfU8BB5V9vwISUzzuRMX - the kernel itself, just in case (config also accessible via /proc/config.gz in booted kernel)

P.S. it’s been built using Franks build.sh

Please merge it 4.16-hdmi-wlan it is much better tree. Goal is to merge it Frank 4.19-main… (if it is ok for Frank?)

Btw. in boot.log there is only 3pcs pixel processors present. Maybe you can add some lines to .dtsi enable 4.th PP…?

And Thank you!!

If mali-changes are working in 4.19 and are clean enough i can merge it. But i prefer 5.4 because dricer itself is already included

For GPU powerup need to write register 0x10003014 bit0 set to 1. Maybe reset GPU also in register 0x10003000 bit5 set to 1. No idea yet how to do that. Need search…

Maybe read status register first? busybox devmem 0x1000301C . If its read 0x1 or more then maybe in lima start:

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);

And samekindof piece to sleep GPU when module unload… (number |= 1 << x;)

Module name: PERICFG Base Address +10003000h

10003000 PERI_GLOBAL                    32bit   Peripheral Software Reset Register0
10003004 PERI_GLOBALCON_RST1            32bit   Peripheral software reset
10003008 PERI_GLOBALCON_PDN0_SET        32bit   Peripheral powerdown register set
1000300C PERI_GLOBALCON_PDN1_SET        32bit   Peripheral powerdown register set
10003010 PERI_GLOBALCON_PDN0_CLR        32bit   Peripheral Power Down0 Register Clear
10003014 PERI_GLOBALCON_PDN1_CLR        32bit   Peripheral Power Down0 Register Clear
10003018 PERI_GLOBALCON_PDN0_STA        32      Peripheral Power Down0 Register Status
1000301C PERI_GLOBALCON_PDN1_STA        32      Peripheral Power Down1 Register Status
10003020 PERI_GLOBALCON_PDN_MD1_SET     32      Peripheral MD1 Power Down0 Register Set
10003024 PERI_GLOBALCON_PDN_MD2_SET     32      Peripheral MD2 Power Down0 Register Set
10003028 PERI_GLOBALCON_PDN_MD1_CLR     32      Peripheral MD1 Power Down0 Register Clear
1000302C PERI_GLOBALCON_PDN_MD2_CLR     32      Peripheral MD2 Power Down0 Register Clear
10003030 PERI_GLOBALCON_PDN_MD1_STA     32      Peripheral MD1 Power Down0 Register Status
10003034 PERI_GLOBALCON_PDN_MD2_STA     32      Peripheral MD2 Power Down0 Register Status
1000305C PERI_GLOBALCON_CKSEL           32      Peripheral Clock selection

0x10003000      PERI_GLOBALCON_RST
bit
5 GCPU_S        W_RST GCPU_SW_RST GCPU software reset
0: Not reset GCPU
1: Reset GCPU

1000300C        PERI_GLOBALCON_PDN1_SET Peripheral Power Down1 Register Set
0 GCPU_PDN GCPU_PDN GCPU power down
0: keep original value
1: Power down GCPU

10003014        PERI_GLOBALCON_PDN1_CLR Peripheral Power Down1 Register Clear
0 GCPU_PDN GCPU_PDN GCPU clear power down
0: keep original value
1: clear power down GCPU

1000301C        PERI_GLOBALCON_PDN1_STA Peripheral Power Down1 Register Status
0 GCPU_PDN GCPU_PDN GCPU power down
0: keep original value
1: Power down GCPU

10003058        PERI_GLOBALCON_DCMFSEL  Peripheral DCM Frequency Selection
20:16 DCM_FULL_FSEL DCM_FULL_FSEL DCM frequency selection for full speed clock
11:8 DCM_HALF_FSEL DCM_HALF_FSEL DCM frequency selection for half speed clock

1000305C        PERI_GLOBALCON_CKSEL    Peripheral Clock Selection
Suggest to set to "half clock" mode when eMMC4.5 HS200 mode is
enable. This can enhance the periaxi/periahb data transfer
bandwidth, thus the eMMC4.5 HS200 mode data bandwidth can be
improved.
bit 0
0: peribus operates at quarter clock
1: peribus operates at half clock

I’ve replaced lima driver in my 4.16-lima with one from mediatek tree - works and boots (with my config and original dts).

lima-4.16 mt.txt (45.9 КБ)

Idk why, but this driver tries to init lima twice:

[    1.218185] INFO@lima_mediatek_init 67 err = -517
[    1.222906] lima 13040000.gpu: soc init fail -517
[    1.227582] lima 13040000.gpu: Fatal error during GPU init
[    1.240971] loop: module loaded
[    1.244353] [WMT-DETECT][I]wmt_detect_driver_init:driver(major 154) installed success
[    1.252210] [SDIO-DETECT][I]sdio_detect_init:sdio_register_driver() ret=0
............................
[    2.730001] [drm] Initialized mediatek 1.0.0 20150513 for 14000000.dispsys on minor 0
[    2.738229] lima 13040000.gpu: Unbalanced pm_runtime_enable!
[    2.743989] INFO@lima_mediatek_init 67 err = 0
[    2.748443] lima 13040000.gpu: bus rate = 500500000
[    2.753315] lima 13040000.gpu: mod rate = 500500000
[    2.758517] lima 13040000.gpu: found 3 PPs
[    2.762648] lima 13040000.gpu: fail to get irq pmu
[    2.767410] lima 13040000.gpu: no PMU present
[    2.771761] lima 13040000.gpu: dlbu 0 0
[    2.775600] lima 13040000.gpu: bcast 0 0
[    2.779502] lima 13040000.gpu: l2 cache 8K, 4-way, 64byte cache line, 128bit external bus
[    2.787745] lima 13040000.gpu: gp - mali450 version major 0 minor 0
[    2.794218] lima 13040000.gpu: l2 cache 128K, 4-way, 64byte cache line, 128bit external bus
[    2.802650] lima 13040000.gpu: pp0 - mali450 version major 0 minor 0
[    2.809069] lima 13040000.gpu: pp1 - mali450 version major 0 minor 0
[    2.815513] lima 13040000.gpu: pp2 - mali450 version major 0 minor 0

First - failed, second successfull.

bpi-r2-gentoo ~ # ls -la /dev/dri/
итого 0
drwxr-xr-x  3 root root        120 дек 31 16:00 .
drwxr-xr-x 13 root root      13520 дек 31 16:00 ..
drwxr-xr-x  2 root root        100 дек 31 16:00 by-path
crw-rw----  1 root video  226,   0 дек 31 16:00 card0
crw-rw----  1 root video  226,   1 дек 31 16:00 card1
crw-rw-rw-  1 root render 226, 128 дек 31 16:00 renderD128
bpi-r2-gentoo ~ #

UPD: dmesg with original lima - just in case.lima-4.16 orig.txt (45.3 КБ)

UPD2: all chandes commited to https://github.com/d3adme4t/BPI-R2-4.14/tree/4.16-lima-mt hope didn’t miss anything.

dtsi is modified, but looks like it doesn’t affect on results, and my config.txt (145.8 КБ)

Looks like second time it inits right after DRM, may be some hook in driver? If so, i dont understand why it can’t init as module…

Some thoughts:

[    1.218185] INFO@lima_mediatek_init 67 err = -517
[    1.222906] lima 13040000.gpu: soc init fail -517
[    1.227582] lima 13040000.gpu: Fatal error during GPU init

Looks like here it fails on larb usage attempt

probably because iommu starts later(actually not iommu, but larbs) :

[    1.878880] mtk-iommu-v1 10205000.mmsys_iommu: bound 13010000.larb (ops mtk_smi_larb_component_ops)

But i can’t get from code how it attempts to init second time, and why rhight after mediatek-drm?

[    2.711818] [drm:drm_minor_register] new minor registered 0
[    2.717484] [drm:drm_sysfs_connector_add] adding "HDMI-A-1" to sysfs
[    2.723823] [drm:drm_sysfs_hotplug_event] generating hotplug event
[    2.730001] [drm] Initialized mediatek 1.0.0 20150513 for 14000000.dispsys on minor 0
[    2.738229] lima 13040000.gpu:  
[    2.743989] INFO@lima_mediatek_init 67 err = 0
[    2.748443] lima 13040000.gpu: bus rate = 500500000
[    2.753315] lima 13040000.gpu: mod rate = 500500000
[    2.758517] lima 13040000.gpu: found 3 PPs
[    2.762648] lima 13040000.gpu: fail to get irq pmu
[    2.767410] lima 13040000.gpu: no PMU present
[    2.771761] lima 13040000.gpu: dlbu 0 0
[    2.775600] lima 13040000.gpu: bcast 0 0
[    2.779502] lima 13040000.gpu: l2 cache 8K, 4-way, 64byte cache line, 128bit external bus
[    2.787745] lima 13040000.gpu: gp - mali450 version major 0 minor 0
[    2.794218] lima 13040000.gpu: l2 cache 128K, 4-way, 64byte cache line, 128bit external bus
[    2.802650] lima 13040000.gpu: pp0 - mali450 version major 0 minor 0
[    2.809069] lima 13040000.gpu: pp1 - mali450 version major 0 minor 0
[    2.815513] lima 13040000.gpu: pp2 - mali450 version major 0 minor 0
[    2.822016] [drm:drm_minor_register] 
[    2.825662] [drm:drm_minor_register] 
[    2.829539] [drm:drm_minor_register] new minor registered 128
[    2.835284] [drm:drm_minor_register] 
[    2.839120] [drm:drm_minor_register] new minor registered 1
[    2.844692] [drm] Initialized lima 1.0.0 20170325 for 13040000.gpu on minor 1

@moore is it your code? Could you please explain this moment, or to point the place where it gets 2nd attempt? Thank You!

Why? it’s literally the same, but with some pulls from mainstream.

Oh, 4.16-hdmi-wlan have working ethernet (same config as Frank 4.19-main). I use ssh to access board…

Btw low priority question: what is “larb”. I found only thai food…

Larb is “local arbiter”…somewhere described in mtk docs…