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
jacobk has quit [Ping timeout: 255 seconds]
jacobk has joined #linux-amlogic
montjoie has quit [Ping timeout: 240 seconds]
montjoie has joined #linux-amlogic
dlan has quit [Read error: Connection reset by peer]
dlan has joined #linux-amlogic
jacobk has quit [Ping timeout: 255 seconds]
hexdump0815 has quit [Ping timeout: 240 seconds]
hexdump0815 has joined #linux-amlogic
jacobk has joined #linux-amlogic
jacobk has quit [Ping timeout: 255 seconds]
jacobk has joined #linux-amlogic
camus has quit [Remote host closed the connection]
buzzmarshall has quit [Quit: Konversation terminated!]
camus has joined #linux-amlogic
vagrantc has joined #linux-amlogic
camus has quit [Quit: camus]
camus has joined #linux-amlogic
vagrantc has quit [Quit: leaving]
f_[xmpp] has joined #linux-amlogic
f_ has joined #linux-amlogic
psydroid has joined #linux-amlogic
gabes2 has quit [Quit: The Lounge - https://thelounge.chat]
gabes2 has joined #linux-amlogic
camus has quit [Quit: camus]
JohnnyonFlame has joined #linux-amlogic
<f_> USB mode in SPL...saw that SPL seems to have support for DFU mode?
<f_> common/spl/spl_ram.c
rockosov has quit [Ping timeout: 255 seconds]
<f_> At least have something standard for USB mode :P
<f_> Some undocumented registers...
<f_> e.g. DMC_DRAM_TAL
<f_> so let's <del>guess the address</del> grep for ddrt.cfg_ddr_al (supposed to be written to that register) in ghidra
<f_> _DAT_c8839140 = (uint)ddrt_p->cfg_ddr_al;
<f_> ^ there's our address.
<narmstrong> f_: can you chainload stuff with DFU? not sure about that
<f_> ¯\_(ツ)_/¯
<f_> I still have to do some more research on what would be the best way to support USB mode
<narmstrong> if dfu can, let's keep dfu then
<f_> I have no idea about if it can do that
<narmstrong> so it seems DFU runs which permits you to write in RAM (run_dfu()) then spl will try to load from this RAM location (spl_ram_load_image()) like if was preloaded in RAM before SPL
<narmstrong> smart
<f_> Yeah that's what I thought by quickly looking at the code.
<f_> So we could write a tiny tool that sends SPL and then just do DFU
<narmstrong> yep
<narmstrong> SPL would init ddr then run dfu for the rest
<f_> <del>steal</del> borrow some code from pyamlboot/aml_boot
<narmstrong> pyamlboot would only be needed to load SPL in BL1
<f_> Indeed
<f_> That's why we need only ~10% of pyamlboot
<narmstrong> !%
<narmstrong> 1%
<f_> 1%?!
<narmstrong> `dfu_alt_info_ram=uboot.bin ram 0x8000000 0x1000000` do DFU would export "ram" to write in it
<f_> sending to BL1 is only 1%???
<f_> so 99% of pyamlboot is used to handle BL2 USB mode?
<narmstrong> compared to the G12A boot sequence, yeah it's ultra basic
<narmstrong> dev.writeLargeMemory() then dev.run() and you're done
<f_> as for the binary to send..instead of using u-boot-gx[bb,l]-with-spl.bin you can just use spl/u-boot-signed.bin
<f_> narmstrong: ah so write to memory and run lol
<f_> BL2 is where the fun ends then :P
<narmstrong> yes
<f_> Sounds good.
<f_> I can try writing a tool that does that
<f_> translate worldcup in french and slap the translation to your tool, you're done
<f_> Should work fine on gxl as U-Boot can switch USB to device mode
<f_> not sure about gxbb though.
<narmstrong> GXBB has a dual mode dwc2
<narmstrong> so it can
<f_> I know, but is that supported in U-Boot?
<f_> That's what I meant by 'not sure'.
<narmstrong> so dfu-util has a --detach option which exits run_usb_dnl_gadget cleanly and continues boot, smart move DFU dudes
<f_> so what shall we do?
<narmstrong> nohingm everything is already done
<narmstrong> got GXBB, it may already work since we declare a dual role dwc2 in DT
<f_> I mean..should we teach people how to use 2 different tools to do DFU?
<f_> 1 to send SPL and the second to send commands to SPL?
<narmstrong> no script should do the load with pyamlboot then continue with DFU if it detects DFU instead of the BL2
<f_> Cut down pyamlboot or actually use it as a library :P
<narmstrong> yeah whatever
<f_> Still have to make it work on gxbb :P
<narmstrong> so it seems nobody tried to enable USB gadget on GXBB
buzzmarshall has joined #linux-amlogic
<f_> I mean sending stuff with pyamlboot
<narmstrong> yeah also
<narmstrong> could probably work as-is, no idea
<f_> Tested an amlogic-usbdl fork a long time ago and it works fine on gxbb
<f_> (of course)
<f_> whatever, just load SPL from USB and mess with DFU
<f_> That's all we need to do.
<narmstrong> yep
f_[xmpp] has quit [Ping timeout: 255 seconds]
<f_> one Amlogic-specific tool to send SPL, and just use one of the many DFU utils available
<narmstrong> we could use https://github.com/bootlin/snagboot that already handled the DFU step
<narmstrong> only the first write + run would be needed to be ported
<f_> It's all python? :P
<narmstrong> yep
<f_> Python everywhere!
<f_> Looks good.
<f_> Just need to implement the BL1 USB mode
<f_> that small gif https://github.com/bootlin/snagboot/blob/main/docs/tutorial_snagrecover.gif also demonstrates how it works.
<f_> Only problem..it's hosted on github
<f_> Not sure if I can create a PR there..
<f_> They said they were going to restrict stuff if I don't enable 2FA.
<f_> narmstrong: snagboot is looks nice though
<f_> *snagboot looks nice though
<f_> Am looking at the code
<narmstrong> there was an embedded recipe talk after mine about it
<f_> Oh nice
mripard has quit [Quit: mripard]
<mkorpershoek> +1 for using snagboot. it's a great project and would benefit from more SoC support
<f_> mkorpershoek: Let's use it then!
<f_> After messing with gxl SPL support.
<f_> 7win 14
<lvrp16> mkorpershoek: wow didn't know about it at all
<f_> lvrp16: Didn't know about it either until narmstrong brought it up.
<f_> +1 for using it as well.
<f_> Not sure how it'll work on g12+
<f_> narmstrong: I guess you do the same thing mostly?
* f_ clones aml_boot
<narmstrong> it's the same goal yes
<f_> Just load a binary and run it?
<narmstrong> snagboot does either recovery, what I do, or factory program, which isn't doable on G12s, but doable on GXL since we can load other binaries in addition to u-boot
<f_> IIRC snagflash just interacts with U-Boot
<f_> >snagflash communicates with U-Boot to flash system images to non-volatile memories, using either DFU, UMS or Fastboot.
<f_> ^ README.md
<narmstrong> hmm ok then not sure we enable any of those on all amlogic platforms
<f_> UMS is enabled.
<f_> (at least on libretech-cc defconfig)
<narmstrong> My plabe was to add support for amlogic, but I failed...
<f_> narmstrong: in snagboot?
<narmstrong> yeah
<f_> Where?
<f_> what failed?
<mkorpershoek> I personally use mostly `snagrecover`. Once I get an U-Boot shell I prefer to use my manual flashing scripts i'm more used to
<mkorpershoek> lvrp16: glad you do now :) ]
<f_> new commit: https://git.vitali64.duckdns.org/misc/u-boot-kii-pro.git/commit/?h=wip/spl&id=66f08ccc4eebf15d2a41d9afb0bf8ec9a5374c4c
<f_> 2 registers I couldn't figure out the address of: POWCTL and POWSTAT.
<f_> Boats well.
<f_> Can't get my USB UART converter to show up..seems like a module is missing
<f_> time to reboot.
f_ has quit [Read error: Connection reset by peer]
f_ has joined #linux-amlogic
<f_> I'm back.
Terry13732293409 has quit [Quit: Bye Bye]
Terry13732293409 has joined #linux-amlogic
<f_> and DRAM pll init os broken...
<f_> s/os/is/
<narmstrong> mkorpershoek: wut you have snagrecover for amlogic ?
<f_> Time to bruteforce PUB register addresses!
<f_> Actually this should be easy.
<f_> The trick is to..well....ghidra
jacobk has quit [Ping timeout: 255 seconds]
<mkorpershoek> narmstrong: no but I use it on other SoCs, like on TI am62x
<mkorpershoek> I think it would be awesome to have snagrecover support for the amlogic socs
jacobk has joined #linux-amlogic
jacobk has quit [Ping timeout: 240 seconds]
jacobk has joined #linux-amlogic
<narmstrong> Yup
<f_> mkorpershoek, narmstrong: Let's make that happen then!
<f_> SPL support on GXBB is pretty much done
JohnnyonFlame has quit [Read error: Connection reset by peer]
JohnnyonFlame has joined #linux-amlogic
f_[xmpp] has joined #linux-amlogic
<f_> I love how amlogic put multiple struct members in acs to then end up not using them.
<f_> e.g. dtar IIRC
* f_ parts.
f_ has quit [Ping timeout: 255 seconds]
jacobk has quit [Ping timeout: 240 seconds]
jacobk has joined #linux-amlogic
jacobk has quit [Ping timeout: 272 seconds]
psydroid has quit [Remote host closed the connection]
JohnnyonFlame has quit [Ping timeout: 255 seconds]
ndufresne has quit [Ping timeout: 255 seconds]