narmstrong changed the topic of #linux-amlogic to: Amlogic mainline kernel development discussion - our wiki http://linux-meson.com/ - ml linux-amlogic@lists.infradead.org - official channel moved from Freenode - publicly logged on https://libera.irclog.whitequark.org/linux-amlogic
psydroid2 has quit [Quit: KVIrc 5.2.6 Quasar http://www.kvirc.net/]
naoki has joined #linux-amlogic
naoki has quit [Quit: naoki]
naoki1 has joined #linux-amlogic
naoki1 has quit [Client Quit]
naoki has joined #linux-amlogic
hexdump0815 has quit [Ping timeout: 265 seconds]
hexdump0815 has joined #linux-amlogic
Daanct12 has joined #linux-amlogic
Daanct12 has quit [Quit: WeeChat 4.6.3]
Daanct12 has joined #linux-amlogic
Daanct12 has quit [Client Quit]
Daanct12 has joined #linux-amlogic
Daanct12 has quit [Quit: WeeChat 4.6.3]
Daanct12 has joined #linux-amlogic
<lvrp16> for the hell of it I added support for all bpw between 1 and 64 to support those oddball transfers like mipi dbi 9 bpw. both pio and dma work although dma for > 8 bits only.
luka177 has quit [Ping timeout: 252 seconds]
luka177 has joined #linux-amlogic
cbeznea has joined #linux-amlogic
djrscally has joined #linux-amlogic
<narmstrong> lvrp16: :shipit: !
ldevulder has joined #linux-amlogic
<lvrp16> Still need to update the comments and clean up thr debug code.
<lvrp16> spicc performance is pretty good against RK and allwinner. I can get 150MHz real out of it.
<lvrp16> It is by far the fastest for SPI displays.
<lvrp16> About 50%+ faster than RK.
luka177 has quit [Ping timeout: 248 seconds]
luka177 has joined #linux-amlogic
llu has quit [Read error: Connection reset by peer]
llu_ has joined #linux-amlogic
llu_ has quit [Read error: Connection reset by peer]
llu has joined #linux-amlogic
llu_ has joined #linux-amlogic
llu has quit [Read error: Connection reset by peer]
Daanct12 has quit [Quit: WeeChat 4.6.3]
ldevulder has quit [Ping timeout: 245 seconds]
buzzmarshall has joined #linux-amlogic
Wkiktor has joined #linux-amlogic
ldevulder has joined #linux-amlogic
naoki has quit [Quit: naoki]
ldevulder has quit [Quit: Leaving]
paulk has quit [Ping timeout: 260 seconds]
paulk has joined #linux-amlogic
paulk has joined #linux-amlogic
<funderscore> nice
<funderscore> I think I managed to reverse-engineer most of the logic behind firmware loading/running. Indeed, aml_ddr.fw is ARM code, but I have some other discoveries to share
<funderscore> first of all, piei.fw is not just one firmware, it's actually 4 of them packed into one file :p
<funderscore> and BL2 iterates through them to know which one is which (hence the "PIEI prepare done" message over UART)
<funderscore> the "fastboot data" stuff I did not bother, as it turns out it fails on librecomputer-alta 🙃
<funderscore> Regarding firmware, what is done is the following: aml_ddr.fw is loaded at 0xfffb4000 (*NOT* 0xfffd0000, I believe that location is just some kind of buffer), after all the useless verification done on that thing. That's the first "🙃
<funderscore> oops. ...That's the first "Load ddrfw from SPI ..." message over UART. Then it loads piei.fw to *checks notes* 0xfffcc000 (once again, after all the verification and such), then like I said it iterates on it to figure out which one is which (since there's in total 4 firmware binaries in that thing). That's the second "Load ddrfw from SPI ..." message.
<funderscore> though I will say I don't know why they weren't any more creative with the names they give over uart, just ddrfw ddrfw ddrfw...
<funderscore> after the piei stuff it first runs `ddr_init_pll()` from aml_ddr.fw, then it loads `lpddr4_1d.fw` (on alta and iirc bpi-cm4 too) and runs some function from aml_ddr.fw I haven't yet figured out
<funderscore> rince/repeat for `lpddr4_2d.fw`
<funderscore> then it runs some ddr test stuff and writes to some register to "Enable ddr reg access" and then you're done
<funderscore> now, regarding this: 17:50 <xdarklight> to all reverse engineering interested people here wanting to take a look at the DDR firmware blobs on G12A and newer SoCs: $ dd if=aml_ddr.fw bs=1 skip=96 | lz4 > foo.bin.dec
<funderscore> the lz4 step compresses the firmware. All you really need is to strip the @DFM
<funderscore> then load in ghidra with base address 0xfffb4000
<funderscore> lvrp16: ^ if you're thinking of trying to save more space maybe you could try trimming piei.fw a bit (disclaimer: I haven't tried that, but it seems BL2 doesn't do any checks on how many piei firmware's there are afaict)
<funderscore> (it just blindly looks at the magic, e.g. dl44 for lpddr4)
<funderscore> Another thing I noticed, at the start of aml_ddr.fw (if you trim the header...) there are various pointers to functions: these are the functions BL2 runs afaik
vagrantc has joined #linux-amlogic
Wkiktor has quit [Quit: Leaving]
luka177 has quit [Ping timeout: 248 seconds]
luka177 has joined #linux-amlogic
<lvrp16> funderscore: What is PIEI exactly?
cbeznea has quit [Ping timeout: 276 seconds]
<lvrp16> They have a few hooks to setup GPIOs, PWMs
<funderscore> PHY Init Engine Image iirc
<funderscore> lvrp16: and yes I saw these hooks :)
buzzmarshall has quit [Read error: Connection reset by peer]
buzzm has joined #linux-amlogic
naoki has joined #linux-amlogic
djrscally has quit [Ping timeout: 276 seconds]
puck has quit [Ping timeout: 268 seconds]
puck has joined #linux-amlogic
luka177 has quit [Ping timeout: 260 seconds]
luka177 has joined #linux-amlogic
vagrantc has quit [Quit: leaving]