Friday, 2020-02-14

*** tpb has joined #litex00:00
*** rohitksingh has quit IRC00:08
*** rohitksingh has joined #litex00:21
scanakciI will try rocket as a first step with ethernet interface to make sure that the issue is not related to BlackParrot. I will also try another switch I guess.00:30
scanakci@daveshah: thanks. will keep in my mind00:30
*** rohitksingh has quit IRC01:10
*** rohitksingh has joined #litex01:15
somlo_florent_: as of right now, litex commit 4d761e1a and liteeth master (466223e) both boots linux (incl. the liteeth driver) *and* is able to use the interface from within linux (ifconfig, wget, etc.)01:27
somlothat's litex before the new soc commits01:27
somloI'll try the "leaky" bisect thing on litex again, to try and narrow it down further01:28
somlobut at least we know it's not liteeth (anymore) :)01:28
somloscanakci: if you do try rocket to test your ethernet functionality right now, I recommend litex up to 4d761e1a, until the dust settles a bit more :)01:30
*** rohitksingh has quit IRC02:16
*** CarlFK has joined #litex04:17
*** _whitelogger has quit IRC04:43
*** _whitelogger has joined #litex04:46
*** rohitksingh has joined #litex04:49
*** rohitksingh has quit IRC04:59
*** tumbleweed_ has joined #litex05:07
*** tumbleweed has quit IRC05:08
*** rohitksingh has joined #litex05:33
*** CarlFK has quit IRC06:30
*** CarlFK has joined #litex07:17
*** rohitksingh has quit IRC08:51
leviRe: ethernet autonegotiation and auto-crossover support:  This is often something configurable in the phy, and often both by pin-strapping and MDIO registers. The designers of the board I'm using for some reason just didn't bother with a useful pin-strap config so the phy comes out of reset in 10Base-T half-duplex mode.  I had to add code to the drivers in the bios and firmware code to set the mdio registers back to09:27
levireasonable values.09:27
leviDumping the mdio registers is at least a good source of diagnostic info for what the phy thinks is going on.09:28
*** tnt has left #litex09:29
*** bunnie[m] has joined #litex09:34
*** nrossi has joined #litex10:16
*** xobs has joined #litex10:16
*** sajattack[m] has joined #litex10:16
_florent_somlo: i just built rocket on arty with ethernet and netboot is working fine here. I'm wondering if your issue could be related to the fact that CSR location have moved and you have not updated the csr.h for Linux or are not using a .dts file? If you want to use fixed CSR Locations, it's possible but you have to specify it in the SoC15:22
somlo_florent_ netboot is working perfectly for me as well. It is the linux driver that's failing: the last "working" commit is 3921b63, the first "bad" one is right after, 379d47a15:56
somloI'd expect to see different values in csr.csv before I'd have to update my dts, but that's not the case15:56
somlo_florent_: is netboot in the bios using irq, or is it polling?15:57
somlo_florent_: for the record, during bisect I had to manually fix things like alignment, importing litedram native2axi, and cpu reset address :)15:59
somlobut aside from all of that, once the bios.bin blob is downloaded over tftp and Linux boots all the way into busybox, when I "ifconfig" my eth0 and attempt to use it from Linux, it either works, or fails with "liteeth 12003800.mac eth0: LITEETH_READER_READY timed out"16:00
somlocommit 379d47a8 looks pretty innocuous to me, but I'm much less familiar with the code than you, so I'll have to study it in more detail to see why it would impact Ethernet, of all things16:02
somlounless it's another one of those "git bisect is really not your friend in this context" issues I've kept bumping into over the last week :D16:03
somlo_florent_: it *may* well turn out that we need to update the linux liteeth driver in some way to fit the new gateware behavior, or not... That is the question :)16:06
somloso I'm building the latest master (18a9d4ff) with blindly reverted 379d47a on top, to see what happens16:22
somloif that "fixes" the issue I'm having, only *then* will I attempt to engage higher brain functions and figure out *why* :)16:23
somlo(might as well make sure I'm on the right track before I potentially overheat my neurons...)16:24
*** rohitksingh has joined #litex16:41
somlo_florent_: ok, reverting 379d47a (on top of latest master) *does* fix my issue16:53
somloso I'll try zooming in on how it might subtly affect Ethernet (and what else, if anything), soon as i get back from lunch :)16:54
_florent_somlo: i'm going to look too16:59
sajattack[m]_florent_: can you look at my vga too?17:05
sajattack[m]https://termbin.com/zu1u717:05
*** rohitksingh has quit IRC17:06
sajattack[m]I'll put up my modifications to litevideo as well17:06
*** rohitksingh has joined #litex17:08
scanakcithanks @somlo. I just tried netboot on Rocket with an older commit than 4d761e1a. No luck. At least, the problem is not directly related to Blackparrot for now :). Looks like a network configuration issue.17:08
_florent_sajattack[m]: i can look yes, have you been able to do some test doing the dma initialization in the firmware instead of the using the linux driver? doing it in the firmware should make things easier to understand/debug17:09
sajattack[m]I looked at it briefly but didn't test it, no17:11
sajattack[m]https://github.com/sajattack/litevideo/tree/de10nano17:12
tpbTitle: GitHub - sajattack/litevideo at de10nano (at github.com)17:12
sajattack[m]I thought you had asked me to look if any of that was specific to 7-series, didn't realize you wanted me to try it17:14
sajattack[m]https://github.com/sajattack/linux-on-litex-vexriscv/tree/vga17:21
tpbTitle: GitHub - sajattack/linux-on-litex-vexriscv at vga (at github.com)17:21
*** rohitksingh has quit IRC17:22
*** rohitksingh has joined #litex17:24
sajattack[m]obviously very WIP code, I'll clean it up when it's working and ready for PR17:29
_florent_the best would indeed probably to integrate the initialization code to the firmware, then try to see if the DMA is outputing data (looking at valid signal or hsync/sync for example with a scope if you have one)17:30
sajattack[m]so bring back emulator/framebuffer.c and associated code?17:32
*** rohitksingh has quit IRC17:42
sajattack[m]I guess just `git revert 9a9f01baf9fa29cfa36d7e0ff0b8cfa2b60a3926`17:45
_florent_yes the commit just before the video initialization moved to the linux driver17:50
* sajattack[m] sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/qnqlIFSIAbSBuYZhcJwKWiiw >18:02
_florent_sajattack[m]: yes that's the 7-series specific part that you can remove18:08
_florent_it's here to configure the clocking18:09
sajattack[m]ok18:09
_florent_but in your case, the pixel clock is fixed and generated by the main PLL18:09
sajattack[m]got it18:10
scanakcitftp worked one time with Rocket :). I could copy a fake boot.bin to DRAM. For a reason, I cant make it work again. It is not failing, just stuck at "fetching from: UDP/69".  Getting closer I guess.18:15
sajattack[m]linux gets stuck at the same spot, do I have to change something in the linux?18:27
sajattack[m]interesting, my tv is switching between "invalid format" and "no signal" now18:27
_florent_sajattack[m]: yes for now no need to boot linux18:29
_florent_just try to get a signal on your tv with the code from the firmware18:29
sajattack[m]ok18:29
_florent_when it will be working, you should see some random data from the DRAM18:30
sajattack[m]maybe it should be hsync_n not hsync? on mister it's called hsync but maybe it's secretly inverted18:30
_florent_but these random datas should be stable on your screen18:30
_florent_once you have that, you can start modifying the firmware to write some data to the DRAM and see if you see these changes on the screen18:31
sajattack[m]ok thanks18:33
*** rohitksingh has joined #litex18:40
_florent_somlo: just looked at 379d47a, and that's the commit that modify the CSR mapping since SDRAM is now dynamically allocated:18:44
_florent_https://www.irccloud.com/pastebin/kYcscEYE/18:44
tpbTitle: Snippet | IRCCloud (at www.irccloud.com)18:44
_florent_so you CSR mapping different from the previous one and this probably explains why it's working in the BIOS but not with the Linux Driver18:47
somlo_florent_: hmmm, and now the csr.csv files are drastically different from each other as well... Guess I *do* have to modify the dts after all18:47
somloI thought I diffed them against each other and they were the same, but then again, the last week or so is a blur :)18:48
_florent_yes, you need to fix the CSR locations on the gateware, use modify the .dts18:48
_florent_if you want to fix things in the gateware, you can do something like that in your SoC:18:48
_florent_https://www.irccloud.com/pastebin/5eA2KtFH/18:48
tpbTitle: Snippet | IRCCloud (at www.irccloud.com)18:48
_florent_and during the SoC elaboration, you should see there locations are reserved in the initial SoC report18:49
somloare they likely to bounce around a lot (in which case it might be worth fixing them)?18:49
somloOtherwise, updating the dts is probably cleaner18:50
_florent_or maybe you could look what we are doing in Linux-on-LiteX-Vexrisv18:50
_florent_we are generating a .json file and regenerating the .dts automatically18:50
_florent_https://github.com/litex-hub/linux-on-litex-vexriscv/blob/master/json2dts.py18:51
tpbTitle: linux-on-litex-vexriscv/json2dts.py at master · litex-hub/linux-on-litex-vexriscv · GitHub (at github.com)18:51
somloare you compiling the dtb blob into the bios as well ?18:51
_florent_not into the bios, the dtb is provided with the linux images18:52
somlothe unpatched BBL actually expects that, I've been adding the dtb in manually as a simple matter of convenience so far18:52
somlooh, I remember, vexriscv linux is booted in several separate blobs18:53
sajattack[m]my hsync pulse is 16.57khz18:53
somloI think the "canonical" "Right Way (tm)" to do it would be to indeed add the dtb to the bios, since that's where all the knowledge is available and authoritative all in one place :)18:53
_florent_somlo: yes that could be a next step :)18:54
sajattack[m]should be 45 :/18:54
somloexcept for 1. it makes the bios larger and 2. it's inconvenient during rapid iteration development :)18:54
_florent_sajattack[m]: ah ok, so that could explain things18:54
sajattack[m]indeed18:55
sajattack[m]is it trying to do 240p somehow?18:55
somlo_florent_: IMHO the first next step would be to add some sort of json2dts.py like thing to LiteX, so that it can generate the dts similarly to how csr.csv is generated right now18:57
somlothen it'd be a super simple makefile hack to optionally work that into the bios18:57
sajattack[m]also it's only outputting an hsync after linux has started18:57
somlo_florent_: that would make half of my out-of-tree BBL hackery disappear altogether :)18:58
_florent_somlo: yes i agree we should and a json2dts.py equivalent directly in LiteX, this one was an experiment and there are others version for Zephyr. We should have a single one integrated.19:00
sajattack[m]I checked the rate of the pll and I think it's correct19:45
somlo_florent_: allright, looks like I'm all the way back in business now :) Thanks for all your help!19:45
* somlo is about to find out if hacking in litesdcard support will shift csr allocations again :)19:46
*** rohitksingh has quit IRC19:55
Xiretzahow exactly does liteeth's wishbone endianness work? it seems to only affect SRAM data, but even that the wrong way around - and accesses to CSRs are always big-endian.20:45
scanakci@somlo: is it possible to send me the necessary file(s) that I should put into my root tftp folder to boot up linux on rocket? After trying the third switch, I can finally copy a file into DRAM using tftp. I guess I only need a bbl based on your explanation here (https://www.contrib.andrew.cmu.edu/~somlo/BTCP/)21:09
tpbTitle: A Trustworthy, Free (Libre), Linux Capable, Self-Hosting 64bit RISC-V Computer (at www.contrib.andrew.cmu.edu)21:09
scanakciFor a reason, the copy process fails if the file size exceeds roughly 30MB.21:09
sajattack[m]my vsync is also about a factor of 3 off21:15
sajattack[m]22Hz21:15
sajattack[m]the proportion of vsync to hsync is correct however21:20
_florent_somlo: good that it's solved!21:24
_florent_Xiretza: it's possible we could avoid the endianness change in LiteEth, but it was probably needed with the way the buffers are accessed from the software in microudp.c21:26
_florent_sajattack[m]: so you pix clk is correct? the core is configured in rgb? Can you remind me the data_width of your SDRAM?21:28
sajattack[m]I think the pixel clock is correct, triple checking it now. Not sure what you mean about rgb, sdram data is 16bits21:29
sajattack[m]yes I'm quite sure the pixel clock is correct, dividing it by 16 gave 4.5-4.8, and setting it to 75 gives roughly the same result as setting it to 74.25 in terms of hsync21:30
sajattack[m]there's no way it can't output a 75mhz clock, while there's a slight chance it couldn't output a 74.25, at least in my mind21:30
sajattack[m]it looks like it's doing rgba, if that's what you mean21:32
sajattack[m]`[    1.377835] simple-framebuffer c8000000.framebuffer: format=a8b8g8r8, mode=1280x720x32, linelength=5120`21:32
_florent_it could also be that the resolution is too high and the SDRAM is not able to provide enough data21:36
_florent_can you try a lower resolution?21:36
_florent_like 640x480 first21:36
sajattack[m]sure21:36
_florent_1280x720x32  = 2.9Gbps, you don't have this bandwidth on your board21:37
_florent_what's the frequency of the CPU?21:37
sajattack[m]oh21:37
sajattack[m]50MHz21:37
Xiretzashouldn't that be immediately obvious from a timing check?21:38
Xiretzaor does litex not do that (by default)?21:38
_florent_sajattack[m]: sorry, my computation is not good, but i still think that's your issue21:39
_florent_it should work with a lower resolution21:39
sajattack[m]ok that makes sense21:40
sajattack[m]I'm synthesizing a 480p version as we speak21:40
_florent_Xiretza: for litevideo or liteeth?21:41
Xiretza_florent_: I'm just wondering how a multi-gigabit clock slipped past synthesis21:42
somloscanakci: http://www.contrib.andrew.cmu.edu/~somlo/BTCP/boot.bin21:42
_florent_Xiretza: ah no it's different, it's the available bandwidth of the SDRAM controller21:43
somloscanakci: note, this is assuming the latest-and-greatest litex, which was working all along21:43
_florent_that is not able to provide enough data for the 1280x720x3221:43
Xiretza_florent_: ooooh I see, that makes sense21:43
scanakcithank you!. One last question, what is lowest frequency that you used to test LiteETH with Rocket?21:43
scanakciI saw some prior discussion which caused some problems on LiteETH due to the CPU frequency. it was a year ago, probably there is still a lowerbound. It may be higher, though.21:44
somloscanakci: so, the blob copies fine over tftp, and linux starts booting at cpu clocks as low as 40MHz21:45
sajattack[m]I must have made a mistake, linux is still trying to do 720p21:45
Xiretzascanakci: it should work down to 30 mhz now: https://github.com/enjoy-digital/liteeth/issues/30#issuecomment-58333558321:46
tpbTitle: Netboot issues with 1Gbps and low CPU frequency (<55MHz) · Issue #30 · enjoy-digital/liteeth · GitHub (at github.com)21:46
somlobut lately the linux ethernet driver initialization (upon kernel boot) started to hang at that frequency21:46
scanakciokay, 40 MHz is great.21:46
somlo60 is my standard goto number that kinda works most of the time :)21:46
scanakci@Xiretza: 30 MHz is even better :)21:46
scanakciI see. above 50 MHz, I am getting some time violations which are hard to interpret for me due to my limited experience. I hope LiteEth works fine with 50MHz.21:47
_florent_scanakci: the theorical minimum is 125MHz/4 = 31.25MHz21:48
somloXiretza: if you figure out more about CSR endianness in the absence of a CPU, please share :)21:49
sajattack[m]_florent_: anythign I need to change other than emulator/framebuffer.c and pix_clk to get down to 480p?21:49
_florent_the data are read on 32-bit words in sys_clk and emitted on 8-bit words at 125MHz21:49
somlofor me, subregisters (basic CSRs) are always accessible in whatever native endianness the CPU is using (I've never built a cpu-less LiteX)21:50
_florent_before the changes, the theorical minimum was 125MHz/2 = 62.5MHz, which explains the issues below 60MHz21:50
somlothen, if compound multi-subregister CSRs are used, the subregisters themselves are always most-significant-chunk first (big-endian *like*)21:50
scanakciokay, for 60MHz I could make tftp work for Rocket. Testing lower one.21:51
scanakcihttps://usercontent.irccloud-cdn.com/file/FOgO3AD2/image.png21:51
scanakcimy litex is outdated.21:51
scanakciThis is the bbl that @somlo provided to me21:51
scanakciI will check BlackParrot as next and see if tftp works fine.21:52
_florent_sajattack[m]: no, you only need to change pix clk and firmware21:53
somloscanakci: you need a linux* rocket variant21:54
scanakcioh totally forgot :).21:54
sajattack[m]ok, trying again, this time undef'ing the 720p rather than commenting it out21:54
somlothe "standard" rocket doesn't have a MMU21:54
sajattack[m]linux still claims it's outputting 720p21:56
scanakciokay.21:56
somloXiretza: here https://github.com/enjoy-digital/litex/issues/314 is what I've been able to figure out about CSRs so far (and I should probably update the references to the code, now that LiteX updated the SoC class hierarchy)21:56
tpbTitle: We need to document LiteX CSRs! · Issue #314 · enjoy-digital/litex · GitHub (at github.com)21:56
sajattack[m]do I need to rebuild the buildroot?21:56
Xiretzasomlo: liteeth's endianness option doesn't affect CSRs, so they're always in litex-native format (big-endian). Don't think I have any multi-chunk registers to worry about.21:57
somloXiretza: "litex-native" CSR format if one adds a little-endian CPU is actually little-endian :) That's what I was wondering what happens if you don't configure a CPU at all, and deal with the exposed data wires directly from the outside, over wishbone21:59
Xiretzasomlo: where does this endianness change occur then?22:00
somlohmm, that's another interesting question: if the litex-internal CPU is L.E. and sees its CSRs as also L.E., would an external CPU looking at the same stuff over a WB or AXI port see them as B.E ?22:01
*** rohitksingh has joined #litex22:01
somloXiretza: _florent_ and I talked about this a bit a while ago, and we *think* it's in the actual wiring of data lines when CPUs are connected in litex/soc/cores/cpu/*/core.py22:03
Xiretzamy observations of liteeth: let's assume there's a 1-byte register containing 0xAB at address 0x100. If I access 0x100, I get back 0x0000_00AB - the byte of interest is in the rightmost position. Now if I receive a byte 0xCD over the network, and read from the SRAM base address 0x200, I get back 0xCD00_0000 with endianness=big. To me, this seems wrong - if I want to get the *byte* at 0x200, I22:04
Xiretzasuddenly have to look at the leftmost byte.22:04
somlobecause if you initialize a scratch register with 0x12345678, for instance, and then read it in over a CSR bus with csr_data_width == 32, it comes back as 0x12345678 on *both* vexriscv *and* mor1k (le and be, respectively)!22:04
Xiretzaright now I work around that by treating the liteeth bus as big-endian, but setting endianness=little in the YAML.22:05
somloXiretza: oh but SRAM endianness might be orthogonal to CSR endianness -- fun and games all around22:06
Xiretzasomlo: what would be an example of a little-endian CPU in litex?22:07
somlovexriscv22:07
somloor Rocket, but if you simulate vexriscv is much faster :)22:07
somloXiretza: also recommend you try "--csr-data-width=32" to compare-and-contrast to the default (which is 8)22:09
somloe.g., "litex/litex/tools/litex_sim.py --csr-data-width 32 --cpu-type vexriscv"22:10
somlothen "mr 0x82000000 0x100" from the bios prompt, to see what things look like to the CPU, from an endianness perspective22:11
somlothe scratch register is 32 bits starting at 0x8200000422:11
Xiretzasomlo: honestly not too concerned with a full litex build, that's another whole can of worms - I'm just looking for a working ethernet MAC.22:13
somloXiretza: that's ok, just figured I'd get you interested in endianness issues, as a sanity check to what I think I know (which isn't much, and some of it is probably wrong) :D22:14
Xiretzasomlo: oh I'm interested, I just wish I didn't have to be ;)22:14
Xiretzaalso, WRITER_LENGTH and WRITER_SLOT always come back as 0, not sure what's up with that, though very likely my fault.22:15
Xiretzaheh, in a way it was! thanks for the csr_data_width suggestion, somlo, I had no idea it was 8 by default - of course reading a whole 32-bit word will only give me a single byte of the multi-part CSR in that case.22:26
Xiretzais there any real downside to having CSRs be as wide as machine words? I guess it might result in a little more logic, but runtime efficiency is way higher.22:32
sajattack[m]_florent_: what do I need to change in linux? there's no hsync until linux starts, and linux is trying to do 720p no matter what22:45
sajattack[m]ah it's the bloody json2dts I think22:47
leviCould be a device tree thing?22:47
sajattack[m]yes I think so levi22:48
sajattack[m]whoever hardcoded this, argh! https://github.com/litex-hub/linux-on-litex-vexriscv/commit/9a9f01baf9fa29cfa36d7e0ff0b8cfa2b60a3926#diff-1b4068987a8de18511d022e172408370L26022:50
tpbTitle: Add litevideo driver · litex-hub/linux-on-litex-vexriscv@9a9f01b · GitHub (at github.com)22:50
leviThere was a helpful #fixme note about it. :)22:51
sajattack[m]lol22:52
sajattack[m]LOL, linux is now reporting 640x480 but still giving me 16khz22:53
sajattack[m]I might have to tap out here22:54
sajattack[m]for now22:54

Generated by irclog2html.py 2.13.1 by Marius Gedminas - find it at mg.pov.lt!