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
vagrantc has quit [Quit: leaving]
<cyrozap> Oh, I see.
<cyrozap> apritzel: What's the code located at lr=53ad8 when returning to FEL? Is that loaded by sunxi-fel or from somewhere else?
adjtm has joined #linux-sunxi
<apritzel> that's the trampoline code injected by sunxi-fel, to save and restore the FEL stack(s)
<apritzel> cyrozap: that corresponds to .thunk_addr = 0x53a00, .thunk_size = 0x200 in sunxi-fel's soc_info.c
<cyrozap> I see, thanks!
<cyrozap> With so many moving parts (boot ROM, stack-saving thunk, 32-to-64 bit transition, 64-bit to 32-bit transition), it's no wonder that a compiler change ended up breaking something. That's not a criticism of the software architecture--obviously it has to be this way to accomodate the quirks of the hardware--it just kind of explains why a small change like this ended up breaking some functionality.
apritzel has quit [Ping timeout: 480 seconds]
adjtm has quit [Quit: Leaving]
cnxsoft has joined #linux-sunxi
<smaeul> any idea where in DE 2.0 between the UI layer and the TCON_LCD could add a blue tint to the image?
<smaeul> context: I'm bringing up an LCD panel on D1. all of the TCON test patterns (LCD_SRC_CEL) have correct colors
<smaeul> but the image from the framebuffer, or the UI layer fill color (LAY_FILLCOLOR_EN) always gets output with the blue channel >50%
Daanct12 has joined #linux-sunxi
<smaeul> https://distfiles.smaeul.xyz/distfiles/tmp/lcd_color_issue.jpg -- Top is the D1 with LCD. Bottom is a PinePhone for comparison.
<smaeul> all of the colors are affected, but it's most obvious that gray becomes blue as it gets darker
hexdump01 has joined #linux-sunxi
hexdump0815 has quit [Ping timeout: 480 seconds]
JohnDoe_71Rus has joined #linux-sunxi
hlauer has joined #linux-sunxi
hentai has quit [Quit: Leaving]
cnxsoft has quit []
apritzel has joined #linux-sunxi
bauen1 has quit [Ping timeout: 480 seconds]
bauen1 has joined #linux-sunxi
apritzel has quit [Ping timeout: 480 seconds]
narmstrong_ has quit []
narmstrong has joined #linux-sunxi
bauen1 has quit [Ping timeout: 480 seconds]
apritzel has joined #linux-sunxi
cnxsoft has joined #linux-sunxi
bauen1 has joined #linux-sunxi
<apritzel> cyrozap: I wouldn't say that it's "expected" to break: Yes, this whole code is tricky and somewhat cumbersome, due to the design, but it shouldn't be fragile.
<apritzel> as we just rely on architecture (32/64 transition) and the BROM behaviour, both of which are not changing
<mripard> smaeul: I'm not sure if you noticed, but it looks like your pixels are shifted by one or two pixels to the right
<mripard> if you look on the left, the blue rectangle has a white band on its left
<mripard> most likely coming from the right most, white, rectangle
<mripard> so it might be some offset somewhere?
<mripard> or a clock polarity issue between the TCON TOP and the TCON?
<apritzel> jernej: re AC200> so I think that making the MFD EPHY device also a reset controller, and referring to that from the actual PHY (MDIO) DT node, should solve the order issue, no?
<apritzel> jernej: and to avoid confusion, we should probably pitch the MFD EPHY device more as some kind of EPHY *control* device
<apritzel> another thing: you fixed the LED polarity and PHY address, should this be controllable via DT properties?
<apritzel> but I guess this can come later ...
evgeny_boger has joined #linux-sunxi
evgeny_boger has quit []
<cyrozap> apritzel: What I mean is that if the SoC was simpler (boots in 64-bit mode instead of 32-bit mode, contiguous SRAM space, more SRAM space, FOSS BROM, etc.), there would be fewer points of potential failure. Like, if space for the SPL was contiguous, there wouldn't be a need to swap buffers around. And if it booted in 64-bit mode, we wouldn't ever have to switch back to 32-bit mode. And relying on
<cyrozap> BROM behavior can be troublesome, because the BROM is closed-source and our understanding of it is likely incomplete.
<cyrozap> Even FEL mode itself is not completely understood, as evidenced by this chunk of code (and others): https://github.com/linux-sunxi/sunxi-tools/blob/76089c82d0e1616aeb3b289790204dce98296477/fel.c#L855-L857
<cyrozap> So while the underlying functions aren't changing out from under us, if we don't have a complete understanding, we can make technical decisions that only apply in certain circumstances but not others, while being completely unaware of that.
<cyrozap> I guess the more concrete example would be, if some of the U-Boot code was relying on undefined behavior and only tested as working with an older compiler, a newer compiler that takes advantage of UB to perform more optimizations might break things.
<cyrozap> Like that instance where a newer version of GCC generated DRAM init code that would fault because the NEON instructions would perform unaligned accesses.
Daanct12 has quit [Ping timeout: 480 seconds]
hlauer has quit [Ping timeout: 480 seconds]
Daanct12 has joined #linux-sunxi
evgeny_boger has joined #linux-sunxi
<apritzel> Well, yes, U-Boot is full of those assumptions, and it's not the most architecture compliant piece of software. But with people testing, we find those issues, and we fix them.
<apritzel> but to be honest: it could be much worse, when we could only boot signed code, or we would need to rely on magic blobs
<apritzel> cyrozap: and keep in mind: Allwinner SoCs were not designed to be nice to software people, actually they were never designed to be "general purpose computers" in the first place
<apritzel> some crazy people just decided to ignore that and make it work anyway, which comes at a price
JohnDoe_71Rus has quit []
evgeny_boger has quit [Ping timeout: 480 seconds]
Danct12 has quit [Remote host closed the connection]
Daanct12 has quit [Read error: Connection reset by peer]
Daanct12 has joined #linux-sunxi
Daanct12 has quit [Read error: Connection reset by peer]
Daanct12 has joined #linux-sunxi
bauen1_ has joined #linux-sunxi
<jernej> apritzel: that's actually pretty neat idea. will you work on that?
bauen1 has quit [Ping timeout: 480 seconds]
<apritzel> jernej: yes
<jernej> great, let me know if you need some help with testing
<apritzel> jernej: did you address the comments from the reviewers on that RFC post?
<jernej> no
<apritzel> ok, no worries, will take care of that
<jernej> because I didn't get no ideas for my main issue
<jernej> s/no/any/
<apritzel> sure, can see that
<apritzel> jernej: one other thing: to some degree this syscon register we already use has some similarities to that I2C register (I think you mentioned that already somewhere)
<apritzel> do we need to skip this syscon code in the MAC driver then?
<jernej> I don't remember talking about that
<jernej> ah, that
<jernej> I only said it doesn't make sense to check for default value
<jernej> wait
<jernej> yes, AC200 EPHY control register is basically the same as in syscon
bauen1_ has quit [Read error: Connection reset by peer]
<apritzel> I guess this syscon register will be ignored when we use the internal PHY?
<jernej> what if we link it to AC200?
<apritzel> yeah, that was the other idea I had
<apritzel> but it sounds tricky, as the format is different, so the MAC would need to know?
<jernej> is it really different? let me check
<apritzel> and also we would need both, depending on which PHY (external or internal) is in use
<jernej> that can be taken care of in DT
<apritzel> or the board .dts would overwrite the syscon link, depending on the PHY to use?
bauen1 has joined #linux-sunxi
<apritzel> cyrozap: getting somewhere: when I enable both CONFIG_DRAM_SUN50I_H616_READ_CALIBRATION and CONFIG_DRAM_SUN50I_H616_READ_TRAINING, but turn off the other two, I see the same behaviour
<apritzel> cyrozap: but when I disable CONFIG_DRAM_SUN50I_H616_READ_TRAINING, it works with both compilers
<apritzel> (not really sure the DRAM actually works, or is stable, but at the least the code runs through)
<apritzel> so I will look at the generated code for CONFIG_DRAM_SUN50I_H616_READ_TRAINING
<jernej> apritzel: yes, I had in mind "overwriting syscon phandle in DT"
<apritzel> cyrozap: (I moved BSS into SRAM, to avoid the SPL touching DRAM at all)
<jernej> apritzel: that would also avoid need to have I2C regmap handle in PHY driver, which was one of the complaints
<jernej> but unfortunately, as you said, registers are not compatible
<apritzel> jernej: cool, I will play with both those options, and see where it takes me
<apritzel> jernej: I actually have an actual AC200 in the Remix Mini PC
<jernej> btw, PHY driver would also get loaded for older SoCs, because it has same ID as internal PHY on H3 and probably others
<jernej> so doing it totally independent of I2C would make a lot of sense
<jernej> apritzel: actually, AC200 EPHY register 6000h layout corresponds to upper 16 bit in syscon
<apritzel> yeah, I saw that, just not sure whether that's good or bad ;-)
Daaanct12 has joined #linux-sunxi
Daanct12 has quit [Ping timeout: 480 seconds]
<jernej> apritzel: I actually see easy solution, although some might say it's hacky
<jernej> apritzel: AC200 EPHY should export regmap, same as syscon
<apritzel> and convert the value written there?
<jernej> but you can implement reg_write callback, where you can shift value there
<jernej> yes
<jernej> and of course fake it to be on offset 0x30
JohnDoe_71Rus has joined #linux-sunxi
<apritzel> worth a try, I guess, we should just be prepared that it could be shot down
Daaanct12 has quit [Remote host closed the connection]
<jernej> another way is to check compatible of phandle and select based on that
<jernej> s/select/use appropriate values/
<apritzel> in the MAC driver, you mean?
evgeny_boger has joined #linux-sunxi
<jernej> yes
bauen1 has quit [Ping timeout: 480 seconds]
<jernej> faking it in regmap isn't really future proof. h616 and h6 have fortunatelly same layout, but that's not really guaranted
bauen1 has joined #linux-sunxi
<jernej> checking compatible in MAC driver seems much cleaner solution, although not ideal
<apritzel> let me see how this ties in with the H616 double syscon problem, I had this patch to add an offset after the phandle: https://github.com/apritzel/linux/commit/0f6bf629c8c819552a16ff3dd4066a14f171806d
<jernej> well, you can't add that to H6, since DT is already out
<jernej> and layout is still different
<jernej> uh, I just hope we don't actually need both registers - syscon for lower 16 bits and AC200 EPHY ctrl for upper 16 bits
cnxsoft has quit []
<cyrozap> apritzel: I appreciate you looking into this issue I've been having with FEL. I took a look at the BinDiff for the "read training" code, but unfortunately nothing obviously wrong jumped out at me. The compiler definitely made a _lot_ of changes to that code, though.
<cyrozap> Mostly instruction ordering and control flow.
bauen1 has quit [Ping timeout: 480 seconds]
evgeny_boger has quit [Ping timeout: 480 seconds]
bauen1 has joined #linux-sunxi
bauen1_ has joined #linux-sunxi
bauen1 has quit [Ping timeout: 480 seconds]
vagrantc has joined #linux-sunxi
JohnDoe_71Rus has quit []
<apritzel> cyrozap: I found one big issue: we put the initial SPL stack at the end of SRAM C, where it grows downwards into the buffer that the BROM uses
<apritzel> cyrozap: and just from simply looking at stack reservations at the beginning of each function, it looks like GCC 12 uses *slightly* more stack than GCC 10
<apritzel> but annoyingly this alone doesn't seem to fix it: I moved the stack below sunxi-fel's thunk and buffer, but it still hangs
<jernej> smaeul: you can also try setting LCD_RB_SWAP bit (23) in LCD control register (0x40)
<jernej> and also resetting fifo with bit 21 in the same register (assert and then deassert)
<jernej> apritzel: I did some tests, and lower 16 bits of H6 syscon for EMAC are still relevant, even with AC200 EPHY.
<jernej> If I set bit 15 (means internal PHY), ethernet stops working
hlauer has joined #linux-sunxi
<apritzel> jernej: ah, thanks, that's good info
vagrantc has quit [Quit: leaving]
vagrantc has joined #linux-sunxi
disctanger has joined #linux-sunxi
<disctanger> configfs error: ``` [ 2035.636565] configfs-gadget gadget: uvc: uvc_function_bind() [ 2035.636608] configfs-gadget gadget: uvc: Unable to allocate streaming EP [ 2035.636647] udc musb-hdrc.2.auto: failed to start g1: -22 ```
<disctanger> My question: Is there any way to get UVC working on this device? Maybe something like recompiling kernel with additional options etc...
<disctanger> By the way, i have tried USB Ethernet on OTG port and it is working fine without issues. I can connect to PineCube from host device after setting up the network.
<disctanger> OS: Armbian focal (22.02.0-trunk.0003) armv7l
<disctanger> Kernel: 5.15.35-sunxi
<disctanger> CPU: Allwinner sun8i Family (1)
<disctanger> lsmod output usb_f_uvc 49152 6 videobuf2_vmalloc 20480 1 usb_f_uvc videobuf2_dma_sg 16384 1 usb_f_uvc libcomposite 45056 14 usb_f_uvc 8189es 1380352 0 cfg80211 495616 1 8189es sun6i_csi 32768 0 axp20x_adc 16384 0 videobuf2_dma_contig 20480 1 sun6i_csi industrialio 57344 1 axp20x_adc ov5640 28672 1 videobuf2
<disctanger> lsmot output: usb_f_uvc, videobuf2_vmalloc, videobuf2_dma_sg, libcomposite, 8189es, cfg80211, sun6i_csi, axp20x_adc, videobuf2_dma_contig, industrialio, ov5640, videobuf2_memops, v4l2_fwnode, videobuf2_v4l2, videobuf2_common, v4l2_async, evdev, rfkill, zram, uio_pdrv_genirq, uio, sch_fq_codel, ip_tables, x_tables, autofs4, pinctrl_axp209, pwrseq_simple, sun4i_lradc_keys, sunxi, phy_generic
<apritzel> disctanger: have you removed the Ethernet gadget configuration before setting up UVC? Each Soc has only a limited number of endpoints, and having multiple gadgets configured at once might exceed this number
<cyrozap> apritzel: I love those kinds of issues--where you find and fix *a* bug but it's not *the* bug that's causing the problem :P
<apritzel> cyrozap: yeah, at the end we might have fixed more than one bug, so it's an even bigger win! ;-)
<apritzel> atm I am trying to figure out what part of SRAM the NBROM is using exactly during FEL operation
<apritzel> and see if I can set up a trap to catch the SPL red-handed when it's clobbering it
<disctanger> apritzel: Yes, there was no ethernet gadged configuration during UVC setup.
hlauer has quit [Ping timeout: 480 seconds]
<disctanger> The OS is freshly installed and i did UVC set up on fresh reboot(while no any other gadgets loaded).
disctanger has quit [Remote host closed the connection]
disctanger has joined #linux-sunxi
disctanger has quit [Remote host closed the connection]