ChanServ changed the topic of #linux-sunxi to: Allwinner/sunxi development - Did you try looking at our wiki? https://linux-sunxi.org - Don't ask to ask. Just ask and wait for an answer! - This channel is logged at https://oftc.irclog.whitequark.org/linux-sunxi
<MasterR3C0RD> Just need to take some time to understand what it's doing exactly; I'll be spending some more time on this in the coming days
<iscle> dram init code has always been a mistery for me
<apritzel> DRAM code is somewhat rocket science, mostly because the authors don't seem to have a real clue about it as well ;-)
<apritzel> so yes, it is "routinely" reverse engineered, but it's still quite tricky to get it into a decent shape, and even then there is mystery, like the occasional mis-detection we see on the H616
<apritzel> but by all means: please give it a go: if you can get it close to the existing code in mainline U-Boot (in style and quality), then I am more than happy to test and eventually merge it
<apritzel> MasterR3C0RD, iscle: there are several components of a DRAM controller, and AW likes to mix and match for new SoCs. So it's worth to check for similarities in *parts* of the code
<iscle> I'll take a look at it after fixing the USB DMA code xD I'm almost there, it sends and receives, but it consistently misses some bytes depending on the length (for example, for 6, 7, 10, 11, 14, 15, 18, 19)
<MasterR3C0RD> Just added in a struct def for the CCM bits in mctl_sys_init, seems to match just about perfectly with that of the H6
<apritzel> MasterR3C0RD: yeah, the CCU seems to be pretty stable over the last few generations, starting with the H6
<apritzel> though don't sweat it with that struct, as we don't need most clocks in the SPL code
<MasterR3C0RD> apritzel: I know, it was just faster to copy the struct and see if the decomp still made sense :-)
<MasterR3C0RD> .away
apritzel has quit [Ping timeout: 480 seconds]
<iscle> it looks like that the usb dma issue is really something to do with the memory itself. by the looks of it, the dma is really transfering the number of bytes that are requested, but the buffer is not filled with the correct contents
<iscle> that's what I receive on the host computer using the serial gadget, the sequence is always sending "a" repeated n times
<iscle> as you can see, when it fails, the data gets filled from the previous buffer
<iscle> s/buffer/dma transfer
<iscle> I have checked with wireshark that the data is really transfered and it's not some host-side error, and it really is transferred like that
<iscle> (For those interested, really cheap and useful, can be found in aliexpress: https://github.com/ataradov/usb-sniffer)
<jakllsch> nice
<jakllsch> hmm, the ones on Ali all seem to be speed bin 4 CPLD and clone FX2 chips
<jakllsch> both things that the github page warn against..
<iscle> jakllsch: Mine is speed bin 4 CPLD and it works just fine, I managed to capture Apple CarPlay data, as well as this USB-Serial data
<iscle> You could always buy this for the PCB and overall assembly and then swap those two chips if they are giving you any issues (which, so far, I haven't experienced)
iscle has quit [Remote host closed the connection]
ftg has quit [Read error: Connection reset by peer]
hexdump01 has joined #linux-sunxi
hexdump0815 has quit [Ping timeout: 480 seconds]
JohnDoe_71Rus has joined #linux-sunxi
montjoie_ has joined #linux-sunxi
montjoie has quit [Ping timeout: 480 seconds]
<MasterR3C0RD> So far, aside from some very minor differences DRAM init code on A133 matches that of the H616, just with different offsets (`SUNXI_DRAM_COM_BASE = 0x4810000`, `SUNXI_DRAM_CTL_BASE = 0x4820000`, `SUNXI_DRAM_PHY0_BASE = 0x4830000`). Still going to try and dig a little deeper; H616 only supports DDR3 memory whereas my device has DDR4.
<tokyovigilante> apritzel: interestingly there are a few differences in the Tina-Linux sources for the H616 CCU, for example using bit 27 as the PLL enable bit, and not modelling the HS audio clock at all, just the 4x. e.g. https://home.xyhcloud.com:1443/tina-linux/linux-5.4/-/blob/f6f0698224f3592db7f44665f3cee62cb0d312e7/drivers/clk/sunxi-ng/ccu-sun50iw9.c
apritzel has joined #linux-sunxi
colinsane has quit []
colinsane has joined #linux-sunxi
JohnDoe_71Rus has quit [Quit: KVIrc KVIrc Quasar 5.2.4, revision: 5.2.4+git-7601-7e87d9ac7, build type: debug, sources date: 20160102, built on: 2024-09-17 16:31:20 UTC 5.2.4+git-7601-]
apritzel has quit [Ping timeout: 480 seconds]
<tokyovigilante> hmm, seems this is more complex than anticipated...
colinsane has quit []
colinsane has joined #linux-sunxi
apritzel has joined #linux-sunxi
<apritzel> tokyovigilante: try to not read too much wisdom into BSP code, I have seen bits that are just nonsense
<apritzel> for many parts it's OKish, but you see that they lack an honest review, and having ideas tossed around like we do on the mailing list
<apritzel> tokyovigilante: on the matter of enable bits: we do this for the D1 (and the upcoming A523) as well, following a recommendation in the manual: keep the PLLs running, and just gate them
<apritzel> tokyovigilante: in general I'd recommend to look at the D1 CCU code, some things are solved differently there (read: better), and if nothing else it's a source of inspiration
<apritzel> tokyovigilante: also the A100 CCU code has some good comments
<apritzel> MasterR3C0RD: are you sure it's DDR4 and not LPDDR4? We have H616 LPDDR4 support in mainline U-Boot now
warpme has joined #linux-sunxi
Hypfer has quit [Quit: Ping timeout (120 seconds)]
Hypfer has joined #linux-sunxi
apritzel has quit [Ping timeout: 480 seconds]
testaccount has joined #linux-sunxi
testaccount has quit []
Hypfer is now known as Guest5564
Guest5564 has quit [Read error: Connection reset by peer]
Hypfer has joined #linux-sunxi
warpme has quit []
Hypfer is now known as Guest5566
Guest5566 has quit [Read error: Connection reset by peer]
Hypfer has joined #linux-sunxi
JohnDoe_71Rus has joined #linux-sunxi
warpme has joined #linux-sunxi
ftg has joined #linux-sunxi
szemzoa has quit [Ping timeout: 480 seconds]
iscle has joined #linux-sunxi
hazardchem has quit [Read error: Connection reset by peer]
hazardchem has joined #linux-sunxi
Hypfer is now known as Guest5572
Guest5572 has quit [Read error: Connection reset by peer]
Hypfer has joined #linux-sunxi
warpme has quit []
iscle has quit [Remote host closed the connection]
apritzel has joined #linux-sunxi
dsimic is now known as Guest5575
dsimic has joined #linux-sunxi
Guest5575 has quit [Ping timeout: 480 seconds]
arti_ has quit []
Hypfer is now known as Guest5583
Guest5583 has quit [Read error: Connection reset by peer]
Hypfer has joined #linux-sunxi
Hypfer has quit [Quit: Ping timeout (120 seconds)]
Hypfer has joined #linux-sunxi
warpme has joined #linux-sunxi
warpme has quit []
Hypfer is now known as Guest5592
Guest5592 has quit [Read error: Connection reset by peer]
Hypfer has joined #linux-sunxi
macromorgan has quit [Ping timeout: 480 seconds]
macromorgan has joined #linux-sunxi
wingrime1 has joined #linux-sunxi
wingrime2 has joined #linux-sunxi
wingrime-ww has quit [Ping timeout: 480 seconds]
<apritzel> junari, jernej: do you have any notes or code for H616 DDR4 DRAM support? This is for A133/R818, but reportedly the code is close to H616?
wingrime1 has quit [Ping timeout: 480 seconds]
Hypfer is now known as Guest5595
Guest5595 has quit [Read error: Connection reset by peer]
Hypfer has joined #linux-sunxi
Hypfer has quit []
apritzel has quit [Ping timeout: 480 seconds]
iscle has joined #linux-sunxi
JohnDoe_71Rus has quit [Quit: KVIrc 5.2.4 Quasar http://www.kvirc.net/]
macromorgan has quit [Ping timeout: 480 seconds]
arti has joined #linux-sunxi
macromorgan has joined #linux-sunxi
wingrime-ww has joined #linux-sunxi
wingrime2 has quit [Ping timeout: 480 seconds]
arti has quit []
arti has joined #linux-sunxi
apritzel has joined #linux-sunxi
<MasterR3C0RD> Approximate header file for the functions called by `mctl_sys_init` in A133 boot0: https://gist.github.com/BrokenR3C0RD/7efa647733f70ee911a90e9bbbf20b87
<MasterR3C0RD> It seems that there'a few differences in the clock setup that's done in `mctl_sys_init`; I'm not sure how many were intentional or not. This is an approximate direct port of the decompiled `mctl_sys_init` from boot0: https://gist.github.com/BrokenR3C0RD/3b622f5981028c56437bd778786af012
<MasterR3C0RD> s/intentional or not/intentional changes by the authors of the H616 code or actual differences from the A133/
<apritzel> thanks for that, but please note that the clock setup is actually the easy part ;-) AW does the full featured PLL setup (incl. pattern), not sure that actually helps or not. We never needed that before though
<MasterR3C0RD> Just had to get that out of the way so I have a better understanding of what I'm doing here; I'm working on the `mctl_com_init` code now
<apritzel> sure, thanks for doing that, and sorry, didn't want to dampen your enthusiasm ;-)
<iscle> MasterR3C0RD: The log you sent for the sonic pad actually shows dram version v0.69, while the code that is in the .o (fake .a) binary is showing an older version. Have you tried decompiling the newer code and see if there are any differences or if it's closer to H616?
<MasterR3C0RD> No I haven't; I didn't even notice that since the commit ID matched what I was expecting
<MasterR3C0RD> The .o is probably easier to work with anyways to start; I can look into it more later, but I wouldn't think the changes are that significant (the .o is v0.59) and the basics are likely similar
<apritzel> AW does some occasional updates, but this more about finetuning, which we can follow up later, the bulk of the code stays the same
ftg has quit [Read error: Connection reset by peer]
<iscle> FINALLY! USB DMA TX seems to be working correctly!
<iscle> An entire week working just on this, lol
<iscle> AW differentiates between two types of DMA: Inner and outer. Inner seems to be a DMA controller which comes bundled together with the USB IP and works exclusively with it. It's what they seem to use in the BSP, but for some reason it is buggy and misses data depending on the number of bytes written. AW only uses DMA for multiples of the endpoint max size (512 bytes on most endpoints) and then uses PIO for the remaining bytes.
<iscle> Instead, I used the outer DMA, which is the normal DMA engine that the entire system uses for other peripherals. And this seems to work just fine, although it required more setup in the dma driver
<apritzel> iscle: awesome, good job!
<apritzel> iscle: but: "An entire week working just on this, lol"> that was somewhat expected, wasn't it?
<apritzel> with "required more setup in the DMA driver" you mean the MUSB sunxi DMA driver, right, not the sun6i-dma driver? So that code goes untouched?
<iscle> apritzel: well, at first I thought this was going to be a 2-3 day job (at most) to get it into a working state, because the DMA registers for the inner dma were quite straight forward and the rest of the glue code was already written for the musb peripheral.... But I was not expecting a buggy dma engine (I'm assuming it's buggy, because I could not find any other reason for it not to work)
<iscle> apritzel: yes, I mean in the musb sunxi dma driver, the sun6i-dma is untouched
<apritzel> great!
<apritzel> have you tested UMS? Is there some performance improvement, or at least less CPU utilisation?
<iscle> I haven't, this board only has 64MB of RAM and 16MB SPI flash which is quite slow. I have a T113-s3 board with SD card slot which I can test on if I get it to boot
<apritzel> iscle: is there anything SoC specific in your code? Or shall it work on all devices using sunxi-musb?
<iscle> I also found that the FIFO configuration that was being used for sunxi devices was a bit off for some of them (which I don't think affects anything, but I created a new one for v853 based on the BSP code that also should be compatible with other SoCs)
<iscle> apritzel: It should work with all sunxi devices
<iscle> Not sure how important the fifo config is, but this is the new config: https://github.com/iscle/linux-v853/blob/b7023ef3ea0a14a5178b00c3b22b92181d77134d/drivers/usb/musb/sunxi.c#L673