Hi everyone, happy Easter/Passover/Ramadan/perfectly-normal-Sunday/etc!

I'm trying to get this project (https://github.com/TriForceX/MiyooCFW) to a 
point where we can build the entire thing from source and have it actually 
work. The piece I'm stuck on right now is the video driver - if I use a 
pre-compiled u-boot then linux can boot and display a picture, but if I 
build u-boot from source, then I can't get any picture. (I know linux 
booted, because one of the initial programs plays a "bing" sound and I can 
hear that. Also, I can make it write logs to a file on the microsd.)

My assumption is that the pre-compiled u-boot is doing some setup that mine 
isn't, and the Linux video driver is (inadvertently?) depending on this 
setup. I'd like to figure out what this setup is and make the Linux driver 
capable of doing it if necessary.

I'm certain that the u-boot source code the project has isn't what was used 
to build the pre-compiled binary because, in addition to the linux video 
issues, the u-boot splash logo is different. (Oh, and I had to set 
CONFIG_VIDEO_SUNXI=y to get it to show any splash logo.)

Worth mentioning, the video driver supports 4 different panel ICs, mine is 
version 2, which uses a ST7789S. I did some work towards documenting it 
here: https://github.com/MiyooCFW/kernel/pull/12/files

I've spent some time reading the source of the u-boot 
<https://github.com/MiyooCFW/uboot/blob/master/drivers/video/sunxi/sunxi_display.c>
 
and linux video drivers 
<https://github.com/MiyooCFW/kernel/blob/master/drivers/video/fbdev/r61520fb.c>,
 
trying to spot the differences, but I haven't yet figured out which 
differences are relevant. I did notice that the u-boot one just draws a 
single hard-coded image 
<https://github.com/MiyooCFW/uboot/blob/2b7c43e6499409ec6accd8fbd73996b42d922bac/drivers/video/sunxi/sunxi_display.c#L1727-L1748>
 
and nothing else, which seems.. less than ideal.

I've tried comparing various bits of memory with printk after booting from 
one u-boot or the other. (For these comparisons, I left CONFIG_VIDEO_SUNXI 
unset in my u-boot build):
      * the result of readl(iomm.lcdc + TCON_CLK_CTRL_REG) 
<https://github.com/MiyooCFW/kernel/blob/9d69b562d8dc252a93af80e399069312e89e2184/drivers/video/fbdev/r61520fb.c#L1117>
 
is
         - with pre-compiled u-boot: `0xF0000006`
         - with u-boot from source: `0`
    * after sending command `0x04` to identify the panel IC 
<https://github.com/MiyooCFW/kernel/blob/9d69b562d8dc252a93af80e399069312e89e2184/drivers/video/fbdev/r61520fb.c#L406>,
 
the response (4 calls to `lcdc_rd_dat()`) is
       - with pre-compiled u-boot:  `0`, `0`, `0x85`, `0x85`
       - with u-boot from source:  `0`,  `0`,  `0`,  `0`

Correcting the TCON_CLK_CTRL_REG and ignoring the identity check and 
instead forcing the panel to v2 are not enough to get video working. There 
are probably some other differences that I haven't found yet.

I spent a lot of time reading through the documentation and source that was 
provided by one of the manufacturers 
<https://drive.google.com/drive/folders/1PAYQC8loV2114ips-0wjMxzbXa4VdLp5>. 
I haven't finished yet, but so far nothing has jumped out at me as "this is 
the fix you need".

I also tried comparing the two u-boot bins with Ghidra's Version Tracking 
tool to try and identify the differences, but I got kind of overwhelmed and 
wasn't able to figure anything out. (I'd only ever used ghidra once before.)

I also found source code for a previous release 
<https://github.com/steward-fu/miyoo/releases>, but hit errors when trying 
to compile it. I didn't go much farther down that route.

I think I could go farther down each of these routes, but I'm not sure 
which one makes the most sense to put more effort into. I suspect that the 
change I need is fairly small, and perhaps even obvious to someone who 
knows more about this stuff, but I kind of feel like I'm just banging my 
head into a wall and not getting anywhere.

So, do you all have any advice for me?

Thanks,
-Nathan

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/6ed50086-7029-4b61-8ecb-d51741911577n%40googlegroups.com.

Reply via email to